Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Disable Manual Entry lookup

Posted on by 575

Hi Experts,

               

i Have a grid in a form.which has several fields(String edit) there are lookups on these fields as well.

the string edit field save the anyvalue (typed in by use or values from lookup)..i dont want this to happen the string edit should take values only from the lookup field.

is there any property that i need to change for this?

Thanks&Regards

Adam

  • Verified answer
    DavidGunawan Profile Picture
    DavidGunawan 1,381 on at
    RE: Disable Manual Entry lookup

    Hi,

    You can't just do simple validation of blank value.

    If the value of ServicePlanId comes from the lookup then you need to validate whether the value exist the list of lookup (either from other table or fixed list, etc).

    For example:

    public boolean validate()

    {

      boolean ret;

      InventTable  inventTable;

      ret = super();

      if(InventJournalTrans.ItemId)

      {

          inventTable = InventTable::find(InventJournalTrans.ItemId);

          if(!inventTable.recid)

               ret = checkFailed("Item ID is not exist in table master item table.");

      }

      return ret;

    }

  • veera seenivasan Profile Picture
    veera seenivasan 575 on at
    RE: Disable Manual Entry lookup

    Hi David,

                  I have added this code but it validation showing for both manual entry field and value selected from the lookup .how to avoid this

                public boolean validate()

    {

       boolean ret;

       ret = super();

       if(smaagreementline.ServicePlanId)

       {

           ret = checkFailed("plan is already suspended");

       }

       return ret;

    }

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 224,528 Super User on at
    RE: Disable Manual Entry lookup

    I agree with using a validation. Don't try to force users to use the lookup form; they may have a valid value copied from elsewhere and they should be able to paste it to the string field. It's important for their productivity.

  • Suggested answer
    DavidGunawan Profile Picture
    DavidGunawan 1,381 on at
    RE: Disable Manual Entry lookup

    Hi,

    The edit field is related/lookup from other tables? If yes, then it will do the validation. If no then you can override validateField() method of the table/datasource. You can put your validation logic in the method.

    Regards

Helpful resources

Quick Links

Can you answer this forum question?

You could make someone's day!

Community Newsletter - May 2024

Kudos to our community stars!

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,632 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 224,528 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans