Sales Order - No not visible

poppinspoppins Member Posts: 647
Hi everyone,

I added some custom code in table 36 in the "Sell-to Customer No." trigger to calculate "Shipment Date" from a setup in the Customer card.
It works fine when the document No is visible in the Sales Order page, but not in the other case.
I tried to debug the code, I found out that when the doc no is not visible, the trigger "Sell-to Customer No." is executed before the "OnInsert" trigger.
So, my custom code is executed and the "Shipment Date" is calculated, then the "OnInsert" trigger is executed with a call to InitRecord which sets the "Shipment Date" back to WORKDATE.

Has anyone faced issues with this doc no invisible before? and how can I detect this in the Sales Header? any ideas?


Thanks in advance :smile:

Answers

  • postsauravpostsaurav Member Posts: 708
    Hi,

    This is a standard scenario and also happens when you select Sales Order Button from Customer Card. The Sell to customer is validated first and Insert trigger executed after that.

    So how it happens is -
    OnValidate of Sell to customer no. first function that is "CheckCreditLimitIfLineNotInsertedYet" being called. This function then calls the InitInsert Which then calls InitRecord.

    In InitRecord the system calculates the Shipment Date.

    There are two ways you can resolve it -

    1. You can write your custom code at the end of "Sell-to Customer No." onValidate. So whatever system need to assign value let it assign (Which is workdate) and then you change it after all standard code related to Validate is complete.

    2. You Can change the Shipment Date in the InitRecord if that make sense. (I am not sure what customization you are trying to do, but that make sense to me).
    In the function InitRecord, Do not comment what standard is doing, just add your custom code at the end of the function after "Responsibility Center" gets the value.

    Do that make sense?

    Thanks & Regards,
    Saurav Dhyani

    Do you Know this About NAV?


    Connect - Twitter | Facebook | Google + | YouTube

    Follow - Blog | Facebook Page | Google + Page
  • aseigleaseigle Member Posts: 207
    Not sure which version you are using, but in 2015 and later, the Document No. is not displayed when there is only a single number series defined for the document type. You could add another No. Series, and then the field will always be shown, because you have to choose the next number.

    You might also be able to just select Manual Nos. for the existing No. series, because then it wouldn't know which number you wanted to use.

    Hope that helps.
Sign In or Register to comment.