- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2016 10:59 AM
I have a requirement to use the approve/reject feature on the grc_remediation table and the workflow works well.
However, the other requirement is to have the approval buttons (Approve/Reject) on the form itself, which I have created as UI Actions. So far so good. However, using the button script from Change, which is found below, it does not move the workflow forward when the button is used on the form itself.
current.approval = "approved"; //or rejected for the Reject button
current.update();
Can this be done? If so, how?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2016 08:46 PM
Figured it out!
I created a UI Action for both Approve and Reject Form buttons and this was the code that moved the workflow forward:
current.approval = "approved";
//current.update();
var ap = new GlideRecord('sysapproval_approver');
ap.addQuery('sysapproval', current.sys_id);
ap.query();
while(ap.next()){
ap.state = 'approved';
ap.update();
}
current.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2016 10:09 AM
Brendan,
Apologies for the delayed response. I tested this in my environment and what I learned is that your Rejected workflow path MUST lead straight to End, if you intend for it to show up as the red X for the Workflow icon.
My workflow is a perpetual state of rejection back to the original requestor allowing them continue to infinitely resubmit their request, so therefore, I have a loop and do not necessarily need to see the red X when going back and forth. It would be nice, but not necessary for my purposes.
This may be a work around, but if you want to send the rejection notification and want to keep the red X icon, create another workflow to capture when the state is set to rejected and then send a notification. If the other community folks have a better way of doing this, I am open to your feedback.
Rhett