Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to populate value of one field to another field in Servicenow ?

User375773
Tera Contributor

Hi All,

I am a beginner with ServiceNow.
I have a requirement to populate Employee number into SSO ID field in user profile (under sys_user table)

Attached is the screen shot.

Can you please help me with the fix script how should I populate the value from 'Employee Number' field to 'SSO ID' field on user profile form?

Thanks in advance.

1 ACCEPTED SOLUTION

Priyanka0402
Mega Sage

Hello @User375773 

 

var gr = new GlideRecord('sys_user');

gr.query();

while (gr.next()) {
var x = gr.getValue('Employee_number_value');
gr.setValue('SSO_ID_value', x);
gr.update();
}

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards

Priyanka

View solution in original post

4 REPLIES 4

Ankit Rawat
Giga Guru

Hi @User375773 ,

 

Try this -

var userPro= new GlideRecord('sys_user');
userPro.query();
while(userPro.next()){
     userPro.<backend name of SSO ID> = userPro.<backend name of employee number>;
     userPro.update();
}

 

Please accept my answer and mark this helpful if it helps.

 

Regards,

Ankit

Priyanka0402
Mega Sage

Hello @User375773 

 

var gr = new GlideRecord('sys_user');

gr.query();

while (gr.next()) {
var x = gr.getValue('Employee_number_value');
gr.setValue('SSO_ID_value', x);
gr.update();
}

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards

Priyanka

Ankur Bawiskar
Tera Patron
Tera Patron

@User375773 

share the script you started

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

sourav1999
Mega Guru

 

• You can populate values of one field to another field in ServiceNow using the following methods:
• Using Transform Maps: Transform maps are used to map fields from one record to another. The ‘Map’ field type allows you to select a transform map that can be used to populate values from one field to another.
• Using Client Scripts: Client scripts can be used to populate values from one field to another. The ‘Script’ field type allows you to select a script that can be used to populate values from one field to another.
• Using Business Rules: Business rules can be used to populate values from one field to another. The ‘Business Rule’ field type allows you to select a business rule that can be used to populate values from one field to another.

 

For asking ServiceNow-related questions try this :

For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.

Link - https://nowgpt.ai/

 

For the ServiceNow Certified System Administrator exams try this :

https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER