How to allow edit a lookup field?

Hi.Everyone.İ have a question.İ have a field a lookup .İts works.But this field must be allow edit = false.And lookup method must be work.How can i do this.

İ want this field allow edit = false and lookup method must be work.

4786.albil.png

What’s the purpose of a lookup if you’re not allowed to set the value to the field?

Because users must use lookup Button.(Picture 1 - This is true) You see users must use lookup field.

7446.p1.png

But some users dont use lookup field.They write this field everything.İ must stop this.(Picture 2 - this is false)

6232.p2.png

If you do not want user to enter any value other then lookup value then write validate to the lookup field.

In order to validate lookup field value, Just overrride the validate method of that field under Form>Datasource>Field>FIeld(Validate) [or] validate field under table level:

& there you can write your logic in such a way that if user trying to enter the value other then the lookup, it should throw an error.

Ex: write similar query in your Validate method.

select firstonly lookuptable

where lookuptable.field== field.AccountRelation;

if (!lookuptable)

{

ret = checkFailed(‘The specified string value does not exists.’);

}

Vishal is right - what you want to achieve is not a read-only field. You want to validate the value provided by a user. It should be normally validated by AX (based on a relation between tables) - if you can’t define such a relation, you have to implement the validation by yourself.

Thank you Martin and Vishal.İ use validate methods.Problem is solved.İ think maybe there is another solution to do this.