populate one field value in same table another field.

siva58
Tera Contributor

i am created new table with below columns.

1. program manager --> reference to program table 

2. user --> reference to user table.

and similarly i have created few string fields.

1, program managers

2. user name 

3. user email

 

my requirement is i need to populate program manager (reference) field value in the program managers (string)field.

7 REPLIES 7

Pavankumar_1
Mega Patron

Hi @siva58 ,

if you need business rule create after update business rule on your table and use below script

 

(function executeRule(current, previous /*null when async*/ ) {
//you can get value of reference field as below
    var manager = current.program_manager.name; //give reference field of program_manager field name and instead of name your value eed to get from that record.
    current.program_managers = manager; // give your string field of program_managers name
    current.update();
})(current, previous);

 

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Pavankumar_1
Mega Patron

Hi @siva58 ,

If your issue got resolved close the thread by Accepting solution and hit thumb icon.

If not reply and share details.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar

Sai Kumar B
Mega Sage
Mega Sage

@siva58 Any update on this?