Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Salesline fielderror help

(0) ShareShare
ReportReport
Posted on by 255

Hey, i have a small issue, hope somebody will help. When i post a salesorder as "shipping" and open it again, the user should not be able to update only one field value in salesline. I managed to code something but it checks every field and shows error instead of one specific. I'm coding it using events with onaftermodify. How can i make it work for only one field, where user is not allowed to change the value for that field, but can do for others.  

*This post is locked for comments

  • Tina Menezes Profile Picture
    Tina Menezes 2,582 on at
    RE: Salesline fielderror help

    Hi,

    You can create a new boolean field in your table which changes to 'TRUE' when the field value is entered for the first time by the user. Now you have to write the following code in OnValidate() tirgger of your field.

    YourField - OnValidate()

    IF BooleanField = TRUE THEN

    ERROR('You cannot modify this field value!');

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 14,302 Super User 2025 Season 1 on at
    RE: Salesline fielderror help

    Always try to follow what standard Microsoft does and then follow the same procedure for custom code.

    As per your scenario once the order is shipped and page is closed. After that if user open the page some field should not change.

    ** In standard NAV Qty. to Ship validates on the same line how you want.

    ** Look into table field validate and try to follow similar bheaviour in your custom code.

    Also you dont need to subscribe the modify event of table, you actually need to subscribe the custom field - Onvalidate Trigger.

  • mmv Profile Picture
    mmv 11,467 on at
    RE: Salesline fielderror help

    Hi,

    You may write the code in the OnValidate trigger of the respective field or you may follow the use of Events. Follow the below link for Events:-

    https://msdn.microsoft.com/en-us/library/mt299505(v=nav.90).aspx

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans