how can i stop background script???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 02:49 AM
how can i stop/ delete background script.
actually i have assigned a role to 577 managers a time., now i want to remove that role from 577 managers...............how can
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 03:01 AM
Hi Kishore,
DId the background script was run and updated?
If updated means you need to run again same background script with the same query and this time not for update but it for delete operation.
var gr = new GlideRecord('sys_user_has_role');
gr.addEncodedQuery(your query condition);
gr.deleteMultiple()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 03:42 AM
i think this not right way...
if we use gr.deleteMultiple()
deleted reaming roles also....please chek once...
i tested deleted reaming roles also..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 03:59 AM
HI D Kishore,
Assuming all this records are created today and you dont have any other records created today in sys_user_has_role table.
var gr = new GlideRecord("sys_user_has_role");
gr.addEncodedQuery("sys_created_onONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)");
gr.query();
while(gr.next()){
gr.deleteRecord();
}
Hope this helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 04:20 AM
See the only difference between deleteMultiple and deleteRecord are, deleteRecord will delete entire record, but deleteMultile except attachment deletes entire record. That's it.
you are telling, it deletes remaining roles also means I guess your query condition may be wrong please check once.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2017 04:27 AM
Hi D-Kishore,
I assume this is already answered in a separate thread and you are satisfied with the result. Can you please mark the answer as correct/helpful and close this thread.