Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Want serial number will be same as Sales order number

Posted on by 1,879

Hi Experts,

Can I make serial number to generate same as Sales order number in Sales order Form. As given below screenshot.

Please suggest how or it can been only by X++ job or any other way.

1581.SO.jpg

Regards,

Faiz

  • Suggested answer
    axk Profile Picture
    axk 925 on at
    RE: Want serial number will be same as Sales order number

    During the form or even data source init() method execution you are not able to get any information about the ItemId, which is necessary to create the InventSerial record.

    You have to execute this logic once the ItemId is set as Nikolaos wrote.  You will probably also have to handle the scenario when the SalesLine is created from X++ code, not by form, so you can check the SalesLineType class and the createLine() method.

  • faiz7049 Profile Picture
    faiz7049 1,879 on at
    RE: Want serial number will be same as Sales order number

    "init on form level" -> how would you know for which item you need to create the serial number?

    Checking if item (Product) type=BOM.

    click on form level" -> there's no click on "form level", so you would need to first clarify what you mean by it.

    Using button but this is not automatically.

    Let me check all possibilities .

    regards,

    Faiz

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Want serial number will be same as Sales order number

    - "init on form level" -> how would you know for which item you need to create the serial number? 

    - "click on form level" -> there's no click on "form level", so you would need to first clarify what you mean by it.

    My suggestion is to create the serial number when the user selects the item id. For this there already exists itemIdModified method in SalesLine data source of SalesTable form.

    Don't forget to delete the serial number if the user deletes the order line or the whole order.

  • faiz7049 Profile Picture
    faiz7049 1,879 on at
    RE: Want serial number will be same as Sales order number

    Hi Experts,

    I got logic to get serial number same as created sales order id.

    I just want to know which are best practice either onclick() method or init() method in form level.

    Regards,

    Faiz

  • faiz7049 Profile Picture
    faiz7049 1,879 on at
    RE: Want serial number will be same as Sales order number

    Hi Nikolaos Mäenpää,

    Requirement is after Finished Goods come to inventory (on-hand form). It should show Serial number same as Sales order number(Production reference is Sales order.

    What is the exact moment in time when the new serial number should be created?

    Serial number should fill automatically once line item added to Sales order form same as Sales order Id.

    What should happen if you need to sell two pieces of the same Item id on one Sales order?

    Just to track that on on-hand form that this Finished goods reference to this sales order.

    7266.SO.jpg

    1346.SO1.JPG

    Please help me..

    Regards,

    Faiz

  • Suggested answer
    axk Profile Picture
    axk 925 on at
    RE: Want serial number will be same as Sales order number

    The system supports the process of the serial number auto-generation, but it does not support the sales orders. But if you want the serial number to be the same as the sales order number it has to be customized anyway.

    As Nikolaos mentioned, you will probably need to customize the process of inserting the sales order line. When it is created, you have to add the combination of ItemId and InventSerialId into the InventSerial table and assign the newly created serial number to the sales order line.

    Be aware that if you want to sell the specific serial number, you have to have the available stock on this serial number. If not, you will have to create transfers to be able to complete the picking and delivery.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Want serial number will be same as Sales order number

    Hi faiz7049,

    what's the business requirement behind this? If you just want to track where each item (serial number) was sold, you can do it without changing the logic for serial number creation.

    Anyway here's how you should be able to achieve it without any customization:

    1) Make sure that number sequence for Serial numbers is set to Manual

    2) Right click the Serial number field -> Go to details.

    3) Create a serial number that mathces the Sales order number

    4) Go back to Sales order form, select the newly created serial number

    If you would like to develop something that would do it automatically, you would need to consider few things:

    - What is the exact moment in time when the new serial number should be created?

    - What should happen if you need to sell two pieces of the same Item id on one Sales order?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans