Copy field value from one field to another in same table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 01:57 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 04:54 AM
Hi Anurag,
yes Its an functionality ...not for one time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2024 09:16 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 03:22 AM
Hi @Community Alums
Please replace 'ga.update()' with 'current.update()'.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2022 05:05 AM
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.
Regards,
Abhijit
ServiceNow MVP