- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 09:29 AM
Hi,
I have to close many hr case without sending notifications to users.
There are many hr case with different hr service.
How I can achieve that.
Regards,
Nivedita
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 05:37 AM
Hello @niveditakumari
var gr = new GlideRecord('sn_hr_core_case');
gr.addEncodedQuery('numberINHRC011111,HRC012344');
gr.query();
while(gr.next()) {
gr.setWorkflow(false);
gr.state = 'Closed Completed';
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 06:12 AM - edited 10-18-2023 06:12 AM
I have correct that and it is working.
var c = 0;
var gr = new GlideRecord('sn_hr_core_case');
gr.addEncodedQuery('numberINHRC01111,HRC01112,HRC01113,HRC01114');
gr.query();
while(gr.next()) {
c++;
gr.setWorkflow(false);
gr.state = '3';
gr.update();
gs.info('HR case closed successful'+c);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 09:41 AM
Hello @niveditakumari
Use this script for the same-
var gr = new GlideRecord('sn_hr_case');
gr.addQuery('number','#####');
gr.query();
if(gr.next())
{
gr.setWorkflow('false');
gr.autoSysFields('false');
gr.deleteRecord();
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:30 PM
Hi @Harsh_Deep,
There are 80 hr case and I need to close that.
How I can achieve that.
Regards,
Nivedita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:59 PM
Hello @niveditakumari
var gr = new GlideRecord('sn_hr_case');
gr.addEncodedQuery('numberIN'+'####,####'); // mention all the number comma separated
gr.query();
if(gr.next())
{
gr.setWorkflow('false');
gr.autoSysFields('false');
gr.deleteRecord();
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 05:33 AM
Hi @Harsh_Deep,
I have written code :
var gr = new GlideRecord('sn_hr_core_case');
gr.addEncodedQuery('numberIN', 'HRC011111,HRC012344');
gr.query();
if(gr.next()) {
gr.setWorkflow(false);
gr.state = 'Closed Completed';
}
It is not working.
Please correct me to achieve that.
Regards,
Nivedita