samybill  
            (Samy Bill)
           
           
          
              
                November 18, 2019, 11:04am
               
               
          #1 
           
         
        
          Hi everyone,
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 ?
Thanks, 
Samy
         
         
           
        
            
            
            
         
         
             
             
          
       
      
        
          
          
            krivopustov  
            (Konstantin Krivopustov)
           
           
          
              
                November 20, 2019,  3:15pm
               
               
          #2 
           
         
        
          Hi Samy,
Then how are you going to enter something for the first Person? There will be no options in the Role field, right?
         
         
        
            
            
            
         
         
             
             
          
       
      
        
          
          
            samybill  
            (Samy Bill)
           
           
          
              
                November 20, 2019,  5:03pm
               
               
          #3 
           
         
        
          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.
         
         
        
            
            
            
         
         
             
             
          
       
      
        
          
          
            mario  
            (Mario David)
           
           
             
          
              
                November 20, 2019,  8:32pm
               
               
          #4 
           
         
        
          Hi,
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 
Cheers 
Mario
         
         
        
            
            
           1 Like 
         
         
             
             
          
            
       
      
        
          
          
            samybill  
            (Samy Bill)
           
           
          
              
                November 21, 2019,  3:54pm
               
               
          #5 
           
         
        
          Hi Mario,
Many thanks, that works !
Best, 
Samy