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

Service Catalog: Do Approval at Request Level

jmiskey
Kilo Sage

Is it possible to do an Approval at the Request level (not the Requested Item level) in a Workflow on an Order Guide (Catalog Item)?  Basically, what we need is someone to first do an "overriding" approval on the WHOLE Request before workflows kick off for each individual RITM.  What may complicate matters somewhat, is that there may be instances in which this approval may not be necessary (there is a table that indicates whether or not it is required, based on what option they select).

I was researching up and came across something that looked promising called "gating approvals", but I am not sure how I would incorporate something like that into a Workflow.

Thanks

4 REPLIES 4

Matt Taylor - G
Giga Guru

It is possible to do an approval at the request level. There is a request record workflow that generates the RITMS which then kick off their own workflows, so idea would be to add an approval to the request record workflow. You might consider copying the default request record workflow, and making any changes to the copy. That way, if needed, you can fall back to the original. 

So, it looks like we have an "Auto-approve Requests" workflow, that runs by default on Request that looks like this:

find_real_file.png

The script in the Run Script action looks like this:

var itm = new GlideRecord('sc_req_item');
itm.addQuery('request', current.sys_id);
itm.query();
var requested_for;
while (itm.next()) {
	requested_for = itm.variables.requested_for;
}
current.requested_for = requested_for; //itm.variables.requested_for.sys_id;

and the "Set Values" step is just setting the "Approval" value on the Request to "Approved".

So I think the trick is to add the approval to the Request, and when it is approved, to allow the RITMs to be created, and to follow their workflow, but if it is rejected, to close out not only the Request but also all the related Requested Items.  I think that is the tricky part.

I had toyed around with trying to add an Approval step to the Request workflow, but it added it as a line-item veto for each of the RITMs (instead of a single Request approval).  So I am unsure how to get that to function properly.

Where in the request record workflow did you place the approval step? You might try adding it before the Run Script. On approval, proceed to the Run Script and if rejected proceed directly to the end.

I did that, but I am having trouble making it filter down to the RITMs accurately.  The RITMs seem to want to operate independently on their own.  I want to make the RITMs wait and not do anything until the Approval on the Request happens.  If approved, then move on to the RITM workflows.  If rejected, cancel and close everything.