UI action for cancel flow

AnandKumar1
Tera Expert

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.

3 REPLIES 3

Abbas_5
Tera Sage
Tera Sage

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

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.

Tai Vu
Kilo Patron
Kilo Patron

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