Multiple RITM for One REQ

Rohant Joshi2
Kilo Expert

I have created 4 RITM under 1 REQ, now customer requirement is not allow the user to open 2nd request RITM until 1st is complete/Resolved. If user wants to open another request without completing 1st one, that form should be visible to user as read only.

Attached is screen shot for more clear view of my query

3 REPLIES 3

kmayur
Kilo Contributor

One approach could be to modify the "Add New Item" U Action and add a condition that checks for all the RITMs for a REQ and checks their state and may be popup an alert if any one of them is still not closed/resolved.


TJW2
Mega Guru

You will want to evaluate how this requirement will impact OOB Business Rules that control RITM/REQ closure. Once all RITMs are closed, the REQ is auto closed. So once your first RITM is closed your REQ will close not allowing you to add a New item.


arundharmabe
Tera Guru

Hi Rohant,



I have a similar requirement, When an RITM state is updated as closed incomplete then stage should change as "Request Cancelled" and it has to set Request approval state in the Request table as "Closed Cancelled". It is working perfectly if request has only one RITM and if it is having more than one then it is closing all the RITM's along with Request. But i want when all the RITM's under a request closed incomplete then only it has to update the request state value as "Closed cancelled" and if atleast one RITM is closed complete then it should set the request state value as "Closed Complete"



Below is the code which i am using, can you help me out on this



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



  var req_item = new GlideRecord('sc_req_item');


  req_item.get(current.sys_id);



  if(req_item.state =='4')


  {


  req_item.stage ='Request Rejected';


  req_item.approval = 'rejected';


  req_item.update();



  var req = new GlideRecord('sc_request');


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


  req.request_state = 'closed_cancelled';


  req.update();


  }



  })(current, previous);