November 18, 2019, 11:04am
I have an entity Person with a field Role. In the edit screen, I would like to use LookupField widget on the field Role. The options of this LookupField should come from the same field Role in the entity Person. Basically using previously used roles.
Anyone can tell how can achieve this ?
November 20, 2019, 3:15pm
Then how are you going to enter something for the first Person? There will be no options in the Role field, right?
November 20, 2019, 5:03pm
Yes, that’s right. The first time it will be empty, but then as new records are created the lookup will be populated with the corresponding values.
November 20, 2019, 8:32pm
What you can do is to store the role as a string Attribute in the person entity.
When opening a screen you configure a Lookup Field for the role attribute.
In the controller you manually populate the options via a “select * from person“.
I created an example for you here:
I hope this helps
November 21, 2019, 3:54pm
Many thanks, that works !