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

UI Action Cancel buttons aren't working.

Andre241
Tera Contributor

Hi, 

 

I created two UI Action cancel buttons for both a parent form and child task. I needed them both for the submitter and reviewer to cancel at anytime. Neither are working.

I have taken screenshots of the parent & child task cancel buttons.

 

Here is the parent cancel button script.

current.setValue("state", "107");
current.comments = "[code]<b>Request Cancelled</b>[/code] by " + gs.getUserDisplayName();
current.update();

var flowGR = new GlideRecord('sys_flow_context');
flowGR.addQuery('source_record', current.sys_id);
flowGR.query();
flowGR.next();
sn_fd.FlowAPI.cancel(flowGR.getValue('sys_id'), 'Cancelled by submitter');

 

Child task cancel button script.

current.setValue("state", "7");
current.comments = "[code]<b>Request Cancelled</b>[/code] by " + gs.getUserDisplayName();
current.update();

var flowGR = new GlideRecord('sys_flow_context');
flowGR.addQuery('source_record', current.sys_id);
flowGR.query();
flowGR.next();
sn_fd.FlowAPI.cancel(flowGR.getValue('sys_id'), 'Cancelled by submitter');

 

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@Andre241 You have checked the client checkbox on both the UI Actions and defined a cancelRequest() function call inside onClick field. Do you have this cancelRequest() function defined some where inside your script field?If yes then does this function do something on the client side?

 

Since the script you shared is the server side script, I recommend emptying the onClick field and unchecking the client checkbox. This should let the script execute on the server side.

 

Also, if this doesn't resolve your issue, try adding gs.info(''); logs. in your script and see at which line the script breaks.

 

Hope this helps. 

View solution in original post

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Andre241 You have checked the client checkbox on both the UI Actions and defined a cancelRequest() function call inside onClick field. Do you have this cancelRequest() function defined some where inside your script field?If yes then does this function do something on the client side?

 

Since the script you shared is the server side script, I recommend emptying the onClick field and unchecking the client checkbox. This should let the script execute on the server side.

 

Also, if this doesn't resolve your issue, try adding gs.info(''); logs. in your script and see at which line the script breaks.

 

Hope this helps. 

Thank you. It worked.