I'm using nav 2017,
Process: I'm assigning the department code to purchase header department code field (reverse to standard) and if any one line's department code changes then remaining lines also changes and purchase header department code also changes.
Issue : 1)I want to empty department code field in purchase header if all the purchase lines are deleted.
2) the department code for purchase line is not auto updating as there is a code in no invalidate() trigger to auto fill department code for purchase lines
0
Answers
Issue 1: You can check if there are any more purchase lines in the purchase order using the OnDelete trigger of the Purchase Line, and if the line you're deleting is the last one, you then clean the department code for the purchase order.
Issue 2: If i got it correctly, what you're saying is that the department code is filled "standardly" in the "No." OnValidate trigger. What you'll need to do depends on your requisites... If you want to always have the department code of your last added purchase line, you'll have to update the rest of the purchase lines in the order with the current department given in the "No." OnValidate trigger. If you want to always have the last updated purchase line department code (if you change the 2nd purchase line department code) you'll also have to write code to the Global Dimension 1 Code OnValidate trigger.
Issue 2 really depends on what your outcome is supposed to be.