Copy field value from one field to another in same table

Community Alums
Not applicable

Hi all,

I'm facing a trouble while trying to copy the field values -Basically we have a custom table with few task types and there are two fields present in the Task A ,I need to copy the fields values from Task A type to  the fields under the Task B type. Can anyone help me out with this please?

8 REPLIES 8

Community Alums
Not applicable

Hi Anurag,

yes Its an functionality ...not for one time 

Hi Anurag,

I had similar Requirement.

1) There is two fields A and B are of type choice list fields.

2) Need to copy/convert A field choice values into B field choice values.

3) they both fields are of  same table cmdb_ci_appl.

4) Help me with what exact script will work and the values will be copied to another filed.

Hi @Community Alums 

 

Please replace 'ga.update()' with 'current.update()'.

 

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

Abhijit4
Mega Sage

You might want to use below script :

(function executeRule (current, previous /*null when async*/ ) {

var ga = GlideRecord('u_pmo_task');
ga.addQuery('u_task_type','Test Recreation');
ga.query();
if (ga.next()) {
ga.u_code_moved_to_test_sit=current.u_code_moved_to_sit;
ga.u_code_moved_to_test_uat=current.u_code_moved_to_uat;
ga.update();

})(current, previous);

 

Please mark answer as Correct or Helpful based on impact.

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP