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.

Is it possible to set the value of URL?

tyagisu
Mega Expert

Hello,

I am moving a scoped application from one instance to another. I have a lot of errors in the update set. I want to skip all of them at once. There are around 213,240 errors. I am planning to use fix script for that. This is the script I am using and not working. I am sure that's not the right way to set  the value of URL field "available_actions".

var gr = new GlideRecord("sys_update_preview_problem");
var qry = 'remote_update_set=7ceb91e9db40ef804718b0f0ef96190c^status=^description=Could not find a table ***** this update requires';
gr.addEncodedQuery(qry);
gr.query();
while (gr.next()) {
gr.available_actions = 'Skip remote update';
gr.update();
}

Any help would be appreciated! 🙂

Thanks in Advance!

Su

1 ACCEPTED SOLUTION

Use the while loop

var gr = new GlideRecord("sys_update_preview_problem");
var qry = 'remote_update_set=7ceb91e9db40ef804718b0f0ef96190c^status=^description=Could not find a table ***** this update requires';
gr.addEncodedQuery(qry);
gr.query();

gs.print("Row Count is: " + gr.getRowCount());

while(gr.next()) {
//You can put gs.action as the action parameter.
var ppa = new GlidePreviewProblemAction(gs.action, gr);
ppa.skipUpdate();
}

View solution in original post

12 REPLIES 12

Hi Ankur,

Did you mean to use this code?

var gr = new GlideRecord("sys_update_preview_problem");
var qry = 'remote_update_set=7ceb91e9db40ef804718b0f0ef96190c^status=^description=Could not find a table ***** this update requires';
gr.addEncodedQuery(qry);
gr.query();

gs.print("Row Count is: " + gr.getRowCount());
while (gr.next()) {
var ppa = new GlidePreviewProblemAction(action, current);
ppa.skipUpdate();
}

Hi Tyagi,

Can you try this and check if 1 error is gone from that total list. i have changed while to if and used gr instead of current.

var gr = new GlideRecord("sys_update_preview_problem");
var qry = 'remote_update_set=7ceb91e9db40ef804718b0f0ef96190c^status=^description=Could not find a table ***** this update requires';
gr.addEncodedQuery(qry);
gr.query();

gs.print("Row Count is: " + gr.getRowCount());
if(gr.next()) {
var ppa = new GlidePreviewProblemAction(action, gr);
ppa.skipUpdate();
}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Thanks for your reply.

No, this code didn't work either.

 

Thanks,

Su

ARG645
Tera Guru

Hey,

Try this

var gr = new GlideRecord("sys_update_preview_problem");
var qry = 'remote_update_set=7ceb91e9db40ef804718b0f0ef96190c^status=^description=Could not find a table ***** this update requires';
gr.addEncodedQuery(qry);
gr.query();

gs.print("Row Count is: " + gr.getRowCount());

if(gr.next()) {
//You can put gs.action as the action parameter.
var ppa = new GlidePreviewProblemAction(gs.action, gr);
ppa.skipUpdate();
}

 

Outputs:

 

Background message, type:info, message: Problem has been skipped. The update that caused this problem will not be committed.

Hey Aman,

 

This Skipped 1 error only. How can I skip all of them?

Thanks a lot!

Su