How to close ritm from backend.

niveditakumari
Mega Sage

Hi, 

 

How to close ritm from backend. 

How to close with background script. 

 

Regards, 

Nivedita 

 

 

1 ACCEPTED SOLUTION

SumanthDosapati
Mega Sage
Mega Sage

Hi,

Try this code

var ritmRec = new GlideRecord('sc_req_item');
ritmRec.addQuery('number','RITM000123');
ritmRec.query();
while(ritmRec.next()){
ritmRec.state= 3;  //check closed state value
//ritmRec.setWorkflow(false); write this line if you dont want any other business rules or scripts to run
ritmRec.update();

 

Mark as correct and helpful if it works.

Regards,

Sumanth

View solution in original post

2 REPLIES 2

SumanthDosapati
Mega Sage
Mega Sage

Hi,

Try this code

var ritmRec = new GlideRecord('sc_req_item');
ritmRec.addQuery('number','RITM000123');
ritmRec.query();
while(ritmRec.next()){
ritmRec.state= 3;  //check closed state value
//ritmRec.setWorkflow(false); write this line if you dont want any other business rules or scripts to run
ritmRec.update();

 

Mark as correct and helpful if it works.

Regards,

Sumanth

Ian Mildon
Tera Guru

There is an OOB Business Rule that handles the closing of the records. Is there a specific issue that prevented the RITM from closing?

As long as the SCTASK's generated from the RITM are completed, and the workflow correctly set the closing values, the RITM Stage should have gone to Completed and Active to false.