Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

How to lock the comments whenever purchase order is released?

Posted on by 1,835

Dear experts,

I am using the nav 2016 version. My requirement is if purchase order is released through the approval process user can not modify the comments(both comments....line and header also). Please give me the suggestion, where I need to write the validation code.

*This post is locked for comments

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: How to lock the comments whenever purchase order is released?

    That was my actual requirement. Now it is resolved. Thank you for your support. You guys are the best. Again thanks.

  • Verified answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: How to lock the comments whenever purchase order is released?

    Hi MKY,

    Similarly this can be done. There is a relation between Purchase Header(38) and Purchase Comment Line(43) on "No" field

    here below Blockediting is a Boolean field

    On the Trigger

    OnAfterGetCurrRecord()

    PurchaseHeader.RESET;

    PurchaseHeader.SETRANGE("Document Type",Rec."Document Type");

    PurchaseHeader.SETRANGE("No.",Rec."No.");

    IF PurchaseHeader.FINDSET THEN BEGIN

      IF PurchaseHeader.Status=PurchaseHeader.Status::Released THEN BEGIN

       Blockediting:=FALSE;

     MESSAGE('PO is Released, cant edit or rewrite new comments');

     END

     ELSE

       Blockediting:=TRUE;

     END;

    Output:

    0636.po.JPG

  • Verified answer
    Tina Menezes Profile Picture
    Tina Menezes 2,576 on at
    RE: How to lock the comments whenever purchase order is released?

    Hi MKY,

    You need to do the following steps

    In table 43 i.e. Purch. Comment Line, you have to declare 'PurchaseOrderTable' as your global variable which is table 38 Purchase Header and write the following code in OnInsert(), OnModify(). OnDelete() trigger of the table:

    Note: The status of the PO once approved changes to 'Released'.

    Delete-error.JPG

    Now after approving the PO, if you try to add, edit or delete the comments you will get following error:

    insert-error.JPG

    Modify-error.JPG 

    Delete-error.JPG

  • mmv Profile Picture
    mmv 11,465 on at
    RE: How to lock the comments whenever purchase order is released?

    You need to customize.

  • manish.yadav Profile Picture
    manish.yadav 1,835 on at
    RE: How to lock the comments whenever purchase order is released?

    Hello experts,

    Comments is saved in other table not in purchase document table. I know your provided idea in the given link.I have applied several places in navision. But in herem my requirement is if after releasing the PO if user is trying to edit the comments or remove the comments to click on comments button....system is flowing the auto message....PO is released, can't edit or rewrite the new comments..

    3652.test01.png

  • Suggested answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: How to lock the comments whenever purchase order is released?

    Hi MKY,

    You can refer my blog.

    www.cloudfronts.com/make-editable-fields-un-editable-based-condition-nav

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,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans