Sales Order - No not visible
poppins
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
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
0
Answers
-
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 + Page0 -
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.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
