web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Suggested answer
    CDsilva Profile Picture
    4,188 on at

    Hi MKY,

    You can refer my blog.

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

  • manish.yadav Profile Picture
    1,893 on at

    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

  • mmv Profile Picture
    11,471 on at

    You need to customize.

  • Verified answer
    Tina Menezes Profile Picture
    2,582 on at

    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

  • Verified answer
    CDsilva Profile Picture
    4,188 on at

    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

  • manish.yadav Profile Picture
    1,893 on at

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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans