Making a field mandatory

Okune_JROkune_JR Member Posts: 2
edited 2020-10-14 in NAV Three Tier
I want when a specific product is selected that field becomes mandatory when it`s a different product the field is not mandatory. how can I achieve this?

Best Answer

  • AlexeyShaminAlexeyShamin Member Posts: 67
    Accepted Answer
    This will show red cross on field
    1. Create global boolean variable. Example: FieldMandatory
    2. on page in ShowMandatory property of field set variable "FieldMandatory"
    3. On OnOpenPage trigger:
    IF SomeCase THEN
    FieldMandatory := TRUE
    ELSE
    FieldMandatory := FALSE;

    This will check field:
    1. On On ClosePage trigger
    IF SomeCase THEN
    TESTFIELD(Field);


Answers

  • AlexeyShaminAlexeyShamin Member Posts: 67
    edited 2020-10-12
    Hello!
    NAV version?

    in standard you can use ShowMandatory property. Add Variable to this property

    Also you can add some check code on page for checking field before closing page(Form)

  • Okune_JROkune_JR Member Posts: 2
    Its Nav 2018 do you have the code for that?
  • AlexeyShaminAlexeyShamin Member Posts: 67
    Accepted Answer
    This will show red cross on field
    1. Create global boolean variable. Example: FieldMandatory
    2. on page in ShowMandatory property of field set variable "FieldMandatory"
    3. On OnOpenPage trigger:
    IF SomeCase THEN
    FieldMandatory := TRUE
    ELSE
    FieldMandatory := FALSE;

    This will check field:
    1. On On ClosePage trigger
    IF SomeCase THEN
    TESTFIELD(Field);


  • krikikriki Member, Moderator Posts: 8,939
    [Topic moved from 'Navision Attain' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2020: 19 & 20 November 2020, Antwerp (Belgium)
Sign In or Register to comment.