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)
Answered

How to set item variant code as mandatory when create new items

(0) ShareShare
ReportReport
Posted on by

Dear all,

I would like to know if there are any settings to make item variant code as mandatory when creating new items on item card?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Alexander Ermakov Profile Picture
    28,096 on at

    You can set any field as obligatory to be filled using Mandatory for the filling in the User Interface:

    msdn.microsoft.com/.../dn757314(v=nav.90).aspx

    msdn.microsoft.com/.../dn789528(v=nav.90).aspx

     

    Check also here, how to add small customization apart from Mandatory field (which is not making a validation):

    forum.mibuso.com/.../how-to-make-a-field-mandatory-newbie-question

  • Suggested answer
    Ashwini Tripathi Profile Picture
    4,624 on at

    You will be required to do somme sort of customization on any event or action.

    Mandatory Field Property as The red asterisk only serves as a reminder that you will be blocked from completing a certain process.

    The ShowMandatory property can be used to mark all page fields, but does not enforce any validation of the field. This means that the user will be able to close a page without entering data.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    There is not standard functionality to make a record mandatory, please add the following code on the item card in the OnQueryClosePage of the trigger, where ItemVariant is of type record Item Variant table.

    OnQueryClosePage(CloseAction : Action None) : Boolean
    ItemVariant.RESET;
    ItemVariant.SETRANGE("Item No.","No.");
    ItemVariant.SETFILTER(Code,'<>%1','');
    IF ItemVariant.ISEMPTY THEN
      ERROR('Please Create Item Variant for the Item %1',"No.");



  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    Hey Kelvin,

    Writing code on OnQueryClose Trigger of the Page will be the best approach for these kind of requirements.

    This trigger gets fired whenever you close the page so you can write with any combination of what you want and system will check every time you close a page.

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)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans