Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Shortage Consumption Worksheet

Posted on by Microsoft Employee

On the shortage consumption worksheet when I enter data in Item No, Variant code and then move onto the "From Zone Code"  and "To Bin Code" SHOPFLOOR shouldn't be allowed.

This should produce an error if it's entered into both of these fields.

 d.jpg

How do you go about Writing this? and In which function 

Thank you!

*This post is locked for comments

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Shortage Consumption Worksheet

    Hello,

    One option is to restrict it on the level as Nareshwar advised by placing warning messages for OnValidate trigger. Another option is to allow user to select the value, but within the next step verify if it has been selected and produce a warning message.

    However generally the best option is not to allow user to actually see any values that he is restricted to select, in particular - to filter them out from the view based on user role settings. So, the user would not even see those values exist.

  • Suggested answer
    RE: Shortage Consumption Worksheet

    Hi,

    On OnValidate on From Bin Code,

    Do write:

    IF "From Bin Code" = 'SHOPFLOOR' THEN

      ERROR('SHOPFLOOR cannot be selected')

    ELSE VALIDATE("From Zone Code");

    and On OnValidate on From Zone Code,

    Do write:

    IF "From Bin Code" = 'SHOPFLOOR' THEN

      ERROR('SHOPFLOOR cannot be selected');

    This way, it'll fire the error at least on one field.

    Hope it helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Shortage Consumption Worksheet

    If you go onto From Bin Code and select SHOPFLOOR from that list it will still populate the From Bin Code and From Zone Code to SHOPFLOOR and ignore the Error. How can i prevent this. I don't think a TESTFIELD would work in this situation???

  • RE: Shortage Consumption Worksheet

    Hi,

    You can probably write a TESTFIELD on the OnValidate of "From Zone Code" field on the relevant table.

    Link: https://msdn.microsoft.com/en-us/library/dd301274(v=nav.70).aspx

    Or you can use ERROR if you need to pop up customized error text.

    IF "From Zone Code" = 'SHOPFLOOR' THEN

    ERROR('SHOPFLOOR cannot be selected');

    You can write this OnValidate of "From Zone Code" field on the relevant table as well.

    Hope it helps.

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans