Options

Making a field mandatory

Okune_JROkune_JR Member Posts: 3
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

  • Options
    AlexeyShaminAlexeyShamin Member Posts: 80
    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

  • Options
    AlexeyShaminAlexeyShamin Member Posts: 80
    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)

  • Options
    Okune_JROkune_JR Member Posts: 3
    Its Nav 2018 do you have the code for that?
  • Options
    AlexeyShaminAlexeyShamin Member Posts: 80
    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);


  • Options
    krikikriki Member, Moderator Posts: 9,096
    [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!


Sign In or Register to comment.