The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to copy old variables values into fields in Fix script

ALEN TRICK
Tera Contributor
Hello everyone.
 
I'm working on a fix script for all of the old records. I want to copy the values of variables into a field. I've returned the following Script but it's not working.
var gd = new GlideRecord('data');
gd.addQuery('sys_created_onRELATIVELT@minute@ago@1');
gd.query();
while(gd.next()){
current.xyz = current.variables.xyz;
current.zyx = current.variables.zyx;
gd.update();
}

Regards,

alen

 
@Ankur Bawiskar 
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

it should be something like this

var gd = new GlideRecord('data');
gd.addQuery('sys_created_onRELATIVELT@minute@ago@1');
gd.query();
while(gd.next()){
    gd.xyz = gd.variables.xyz;
    gd.update();
}

Regards
Ankur

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

it should be something like this

var gd = new GlideRecord('data');
gd.addQuery('sys_created_onRELATIVELT@minute@ago@1');
gd.query();
while(gd.next()){
    gd.xyz = gd.variables.xyz;
    gd.update();
}

Regards
Ankur

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

Aman Kumar S
Kilo Patron

Hi @ALEN TRICK 

You have to share more details, from which table you are trying to table and what exact details you want to be copied.

Not really much to go on with here.

Best Regards
Aman Kumar