Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Add a functionality to the 'Purchase Order' page.

Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add a functionality to the 'Purchase Order' page.

    Thank You Sir for the help!

  • Verified answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Add a functionality to the 'Purchase Order' page.

    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.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add a functionality to the 'Purchase Order' page.

    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.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add a functionality to the 'Purchase Order' page.

    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.");

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,137 Super User 2024 Season 2 on at
    RE: Add a functionality to the 'Purchase Order' page.

    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?

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans