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

UI action Cancel button only cancelling the ritm not the request as well

Joshua Comeau
Kilo Sage

Need to know why the cancel button I created is not cancelling the request as well:

JoshuaComeau_0-1688562729675.png

 

1 ACCEPTED SOLUTION

Yes like this, I added the script too.

-Anurag

View solution in original post

10 REPLIES 10

Your script plus my script.


var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request);
req.query();
if(req.next())
{
req.stage = 'closed_incomplete';
req.state = 4;
req.update();
}
current.request_state = 'closed_cancelled'
current.stage = 'closed_incomplete';
current.state = 4;
current.update();

 

 

-Anurag

@Anurag Tripathi 

like this?

current.request_state = 'closed_cancelled';
current.stage = 'closed_incomplete';
current.state = '4';
current.update();

var request = new GlideRecord('sc_request');
var currentReq = current.request;
request.addQuery('sys_id', currentReq);
request.query();
if(request.next())
{
request.request_state = 'Closed Cancelled';
request.stage = 'Closed Incomplete';
request.state = '4';
request.update();
}

can you paste the script on how you believe it should be?

Yes like this, I added the script too.

-Anurag

Amazing it worked, I appreciate that!

 

 

What if there are multiple requested items are there ?