The CreatorCon Call for Content is officially open! Get started here.

If RITM state is set to closed incomplete, the relevant request should get closed incomplete

arundharmabe
Tera Guru

Hello Genius,

I have a small requirement, If RITM state is set to closed incomplete, the relevant request should get closed incomplete. Due to workflow it is not updating it properly. Can any one help me on this please.

Kindly note, when the RITM is set to Closed Incomplete, we have to set RITM stage as closed incomplete & RITM Approval as "Rejected" and REQ Request state as "Closed Incomplete" & REQ Approval as "Rejected". I have tried few ways but no luck.

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

Hi Arun,



I have tried below Business rule on after insert/update on sc_req_item and it's working, please try and see if it helps.



(function executeRule(current, previous /*null when async*/) {


  // Add your code here


  var req_item = new GlideRecord('sc_req_item');


  req_item.get(current.sys_id);



  if(req_item.state =='4')


  {//Set your appropriate state here


  req_item.stage ='Closed Incomplete';


  req_item.approval = 'Rejected';


  req_item.update();



  var req = new GlideRecord('sc_request');


  req.get(req_item.getValue('request'));


  req.request_state = 'Closed Incomplete';


  req.approval = 'Rejected';


  req.update();


  }


})(current, previous);



BR Configuration:



find_real_file.png


find_real_file.png


View solution in original post

10 REPLIES 10

sachin_namjoshi
Kilo Patron
Kilo Patron

hi arun,



you can refer below code as reference and modify as per your requirements.



match ritm states to closed task states



Regards,


Sachin


She Sull
Giga Guru

You should be able to achieve this with a set values utility on the workflow. Or, if you want to do it across the board (and not just individual workflows) then do an after business rule on the ritm...after ritm state changes to closed complete query for the related request and set its state.


Shishir Srivast
Mega Sage

I believe you can achieve this by having the After Insert/update Business Rule on RITM table with the condition when RITM stage as closed incomplete.


Shishir Srivast
Mega Sage

Hi Arun,



I have tried below Business rule on after insert/update on sc_req_item and it's working, please try and see if it helps.



(function executeRule(current, previous /*null when async*/) {


  // Add your code here


  var req_item = new GlideRecord('sc_req_item');


  req_item.get(current.sys_id);



  if(req_item.state =='4')


  {//Set your appropriate state here


  req_item.stage ='Closed Incomplete';


  req_item.approval = 'Rejected';


  req_item.update();



  var req = new GlideRecord('sc_request');


  req.get(req_item.getValue('request'));


  req.request_state = 'Closed Incomplete';


  req.approval = 'Rejected';


  req.update();


  }


})(current, previous);



BR Configuration:



find_real_file.png


find_real_file.png