Request item auto-close after creation

Vengeful
Mega Sage

How to make request item auto-close after submission or creation?

No certain number of days, just upon submitted.

5 REPLIES 5

Rao Vamshi
Kilo Guru

Hi @Vengeful 

To make requested item auto-close upon submission or creation, you can create a business rule that triggers when the item is submitted.
The rule can include a script that sets the state of the item to closed, there are few examples of similar business rules.

Possible to only request an item x number of times a day 
Auto close Requested Items 

It is also possible to create a client script that calls a script include using Glide Ajax to set the state of the item to closed.


Please mark helpful/correct, if your query is addressed and/answered!


Thanks,
Vamshi

Hello @Rao Vamshi 

I tried the "Possible to only request an item x number of times a day " since it's for a certain catalog item, but there's an error.

Merza_0-1682548123195.png

 

Hi @Vengeful 

Can you try this script which can be used in BR that actually triggers when a requested item is submitted. It is checking, if there are any open request items associated with the current request and when found there are no open request items, the script sets the state of the request to 'Closed Complete'.

if (current.state == 'Closed Complete') {
return;
}
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.request);
gr.addQuery('state', '!=', 'Closed Complete');
gr.query();
if (!gr.hasNext()) {
current.state = 'Closed Complete';
}

})(current, previous);



Let me know if you have any further queries. 

 


In case of query been addressed and/or answered, please mark helpful/correct!



Thanks,
Vamshi

Hi @Rao Vamshi 

Is this for a specific request item or service catalog item?