Reputation: 33
I would like to create a dropdown in AX form so that only the user from specific company see this field as a dropdown and other company see it as string field that user have to manually key in. I only manage to create the dropdown list based on table menu, but have no idea how to limit to specific company.
This create a problem since not all company wants dropdown and If the user key in none registered number, the system will return “ the value xxx in the field yyy is not found in the relating table zzz
How can I set the condition so that only selected company see this field as dropdown and the other company see this as string? And also where to locate the condition?
Upvotes: 0
Views: 934
Reputation: 5117
You could add two fields to your form, on with the lookup and one without. You could then use the security setup to control which users have access to which field. Note that this may not work if you have users that work in both companies that use the field with lookup and companies that use the field without lookup.
Upvotes: 0
Reputation: 11564
You may need to set the form control property AutoDeclaration=Yes
and then dynamically change the FormStringControl.LookupButton
(see here) based on the current company (curext()
).
You must also decide if you have a relation on your table, whether or not you want it to be enforced (Validate=[Yes/No]
). If you are allowing a free-text field input, I would imagine you would want No
, but you could perform validation in the validateField
or validateWrite
method.
Depending on your situation, you may want to create a custom lookup
with a condition.
See how to create custom lookups here - https://learn.microsoft.com/en-us/dynamicsax-2012/developer/how-to-add-a-lookup-form-to-a-control
You'll have to experiment a little, but this information should point you the right direction.
Upvotes: 1