UI action for cancel flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 11:32 AM
HI,
I have 1 requirement in Certificate and inventory Module.
When i initiate the Cancel Renewal UI action. I need to bring the info message that, instead of cancelling the renewal do you need to revoke the certificate. If yes, then it should redirect to a catalog which i use. if user click the info message cancel then it should cancel the renewal.
I can bring the message but couldn't decide the flow for redirecting. Can someone assist here?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 07:49 PM
Hello @AnandKumar1,
For similar kind of requirement, please refer to the link below:
https://www.servicenow.com/community/developer-forum/cancel-ui-action/m-p/2340346
Mark my correct and helpful, if it is helpful and please hit the thumbs-up button to mark it as the correct solution.
Thanks & Regards,
Abbas Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2024 02:15 AM
Hi Abbas,
Thanks for your reply. I have done with server part. But the only gap is when i display showMessage. If user set ok then it should redirect to catalog if they set cancel in show message this should update my form record to set close incomplete.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2024 08:54 PM
Hi @AnandKumar1 ,
You can leverage the below FlowAPI to cancel a specific Flow in your UI Action.
cancel(String contextId, String reason)
Sample below.
var gr = new GlideRecord('sys_flow_context');
gr.get('source_record', current.getUniqueValue());
sn_fd.FlowAPI.cancel(gr.getUniqueValue(), gs.getMessage('manually by {0}', gs.getSession().getUserName()));
Cheers,
Tai Vu