Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to lock the comments whenever purchase order is released?

(0) ShareShare
ReportReport
Posted on by 1,893

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
    1,893 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
    4,188 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
    2,582 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
    11,469 on at
    RE: How to lock the comments whenever purchase order is released?

    You need to customize.

  • manish.yadav Profile Picture
    1,893 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
    4,188 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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics NAV (Archived)

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2

#1
mmv Profile Picture

mmv 2

#1
Amol Salvi Profile Picture

Amol Salvi 2

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans