REQ and RITM status

Simona6
Tera Contributor

As I submit the request REQXXXXX is created with Approval and request state field which is in APPROVED state

RITMXXXX is created in Requested Item.

Requirement-User want as the REQ is created  Approval field should be 'Requested' and Request state should be 'Pending Approval'.If user Approve the RITM,Approval=Approved and Request State=Approved.If user reject,Approval=Rejected and Request state=closed Rejected.

Is it even possible?

What is the best way to do that and how?

 

 

 

11 REPLIES 11

Yash Agrawal1
Tera Guru

If you want when RITM will be approved, the status of REQ change accordingly, it should not be in the Approved state.

Please write the business rule on ritm,so that when ritm state is changed->req stste is also changed accordingly.

var gr=new GlideRecord('sc_request');

gr.addQuery('number',current.request);//here we are searching REQ record which have number same as entered in RITM

gr.query();

if(gr.next())//If found

{

gr.approval=current.approval;//setting RITM approval to REQ approval value.

}

If you feel, my answer helped you, then please mark my answer correct and helpful.

If you want more help .please keep us posted to help you.

Regards

Yash Agrawal

Did it worked on your instance?It didn't worked for my instance.

There is out of box functionality already one BR executing for sc_request table named 'set request state'.