copying one field value to other of same table for all the historic data

poojavaishnav
Tera Contributor

Hello all,

 

I am just having a confusion for moving the data from one field to another of user table for all the existing records. The confusion is what method should I opt flow designer, schedule job or fixed script? Which method is best fit.

 

I tried with flow designer first, its working fine when tested but I am running it once at a specific time to move one field data to other but it's not working. I found the issue is with time zone. Can anybody suggest, the time shown in executions of flow designer is which time zone and how it's taken.

 

Thank you

 

1 ACCEPTED SOLUTION

Anand Kumar P
Giga Patron
Giga Patron

Hi @poojavaishnav ,
Flow Designer is suitable when you want to create a workflow-like process that may involve multiple steps and conditions. It provides a visual interface for building workflows.
Use fix script for this,

var userGr = new GlideRecord('sys_user');

// Add any conditions if needed (e.g., to filter specific records if not please do not include addQuery)
userGr.addQuery('your_field', 'your_value');

userGr.query();

while (userGr.next()) {
var sourceValue = userGr.getValue('source_field'); // Replace 'source_field' with your source field name

userGr.setValue('target_field', sourceValue); // Replace 'target_field' with your target field name

userGr.update();
}

Thanks,

Anand

View solution in original post

2 REPLIES 2

Tony Chatfield1
Kilo Patron

Hi, perhaps you could provide clear details of your requirement and the business drivers behind the requirement; this would allow the community to review and advise but without any clear details of your configuration and issue any response is just guessing.

If you are moving data from 1 field to another field as a 1 off occurrence, then a fix script would be the most appropriate way to deliver this.

Anand Kumar P
Giga Patron
Giga Patron

Hi @poojavaishnav ,
Flow Designer is suitable when you want to create a workflow-like process that may involve multiple steps and conditions. It provides a visual interface for building workflows.
Use fix script for this,

var userGr = new GlideRecord('sys_user');

// Add any conditions if needed (e.g., to filter specific records if not please do not include addQuery)
userGr.addQuery('your_field', 'your_value');

userGr.query();

while (userGr.next()) {
var sourceValue = userGr.getValue('source_field'); // Replace 'source_field' with your source field name

userGr.setValue('target_field', sourceValue); // Replace 'target_field' with your target field name

userGr.update();
}

Thanks,

Anand