Hello,
Now I'm working on 'Purchase Order' page. Within the 'Lines' fasttab there is a field called 'Department Code'. I need to add a functionality to this field. If an user doesn't select any options for this field then the 'Purchase Order' page will not be posted. User have to select an option in this field. How could I implement this? If you help me with the code & where to write then it will be very helpful to me.
Regards,
*This post is locked for comments
Thank You Sir for the help!
Hi,
If the Department Code is a Dimension in your case, and if you want to prevent users from posting the PO if the Department Code is not filled, you can just setup that restriction, setting this dimension as mandatory on the e.g. account used for booking payables. Thus users will not be able to post the PO without selecting some dimension value.
I agree with Mohana.
Rajat, what exactly are you trying to do? You questions seems more of very basic in nature.
Better you go through the complete documentations, read blogs, go through the standard NAV coding and try to understand at your end.
Also, if needed go for technical training, which would give you result much faster instead of spending so much of efforts & time by learning this way.
Go to Page 50 >Purchase Order > Post - OnAction()
Write the following code.
PurchLine.RESET;
PurchLine.SETRANGE("Document No.","No.");
PurchLine.SETRANGE("Department Code",'');
IF PurchLine.FINDFIRST THEN
ERROR('Department Code must not be blank in Line No. %1',PurchLine."Line No.");
Please try yourself first and let us know what problems are you facing.
what will you do if we tell you what to write and where to write?
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156