I have to close many hr case.

niveditakumari
Mega Sage

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

 

 

2 ACCEPTED SOLUTIONS

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();
} 

View solution in original post

 

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);

 

 

View solution in original post

8 REPLIES 8

Harsh_Deep
Giga Sage
Giga Sage

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.👍

Hi @Harsh_Deep

 

There are 80 hr case and I need to close that. 

How I can achieve that. 

 

Regards, 

Nivedita

 

 

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.

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