populate field

lakshman nalla
Tera Contributor

how to populate a custom field from a table by using reference table data

6 REPLIES 6

Peter Bodelier
Giga Sage

Hi @lakshman nalla,

 

You are going to have to give more detail than this, to get a satisfactory answer.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

hi @Pmeter Bodelier ,

I'm trying to auto populate employee's manager by using another table's data, in these two table we have employee number is common. while I'm entering the employee name- manager name should auto populate here employee name is a reference field 

@lakshman nalla 

 

Are you using any script to autopopulate manager field?

share your script if you have written

 

Thanks,

Manjusha Bangale 

Hi @lakshman nalla,

 

Allright, then you would need to use a Business rule, which may look something like this, assuming this is triggered from user record:

Of course you will have to adapt the table and field names to your situation

var manager = new GlideRecord('<<usermanagertablename>>');
if (manager.get('<<employeenumberfield>>', current.getValue('user_name'))){
    var managerUser = new GlideRecord('sys_user');
    if (managerUser.get('user_name', manager.getValue('<<managerusernamefield>>'))){
        current.manager = managerUser/getUniqueValue();
    }
}

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.