How could I implement an approval workflow for a request launched from a button?


As stated in $subject, I would like to implement an approval workflow when the user submits a request from a button.

I have created the button and dialog, pointing to a Request. Then I have implemented the logic behind my Request in /System/Request and everything is working fine.

Now, I would need someone to approve the request. There is no ‘miq_request’ object in $evm.root, so I don’t have the methods “approved”, “pending”, etc… that comes with this object. How would you proceed ?



Have you thought about posting a REST automation_request from your button? This should work with approval as its a proper request being generated, and one of the parameters is approval.


I just tried it from an external script (easier to adapt) and I have an ‘miq_request’ object. It creates a request in the WebUI but there is no button to approve/deny the request, so it is stuck in pending state… unless I add ‘auto_approve => true’ to my API call, which obviously not what I need :wink:


I realise this is an old-ish thread, but I am in the same boat right now. Is there an answer for this?

I found this in the CloudForms & ManageIQ Automation How-to Guide … (git book in -progress by Peter McGowan)

"We see that the Request object has several approval-specific methods that the Task object doesn’t have (or need), i.e.

We can use these methods to implement our own approval workflow mechanism if we wish."

Based on that I think I need to copy some approval policy instances from (for instance) /ManageIQ/System/Policy/MiqProvisionRequest_* and rename them to /MyDomain/System/Policy/AutomationRequest_* – which I have done, and then it should just sort of magically work … except it doesn’t …

But based on the converstaion in this thread, it seems the reason it doesn’t is that when you run an automation from a button, an automation request is not created, unless you make the button create one via a REST API call. Cool - I think I can figure out how to do that, but what about the Approve/Deny button in the request as mentioned by fdupont above … do I need to do some thing to create one of those, or is this a bug that has been fixed already?


Hi Stephen

You were on the right lines, but there is slightly more wiring to be done. You’re not the first to ask this, so I’ve added a section to the gitbook on implementing a simple sample approval workflow for automation requests:



That is awesome! Exactly what I’ve been looking for! Thanks indeed … You need a beer! – where should I send it?