- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 07:13 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 08:07 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 07:31 AM
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();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 07:48 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 07:53 AM
Thanks for your reply.
No, this code didn't work either.
Thanks,
Su
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 07:55 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 08:01 AM
Hey Aman,
This Skipped 1 error only. How can I skip all of them?
Thanks a lot!
Su