- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2022 07:42 AM
Hi All,
I have written the below code but nothing is working. Please suggest.
Please note that the UI Action is on my custom table.
function withdraw(){
if(confirm('Are you sure you want to cancel this request?')){
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'loaner_res_withdraw'); //MUST call the 'Action name' set in this UI Action
return true; //Abort submission
}
return false;
}
// Server side code
if(typeof window == 'undefined')
serverLoanerWithdraw();
function serverLoanerWithdraw(){
current.active=false;
current.state=5;
var workflow= new Workflow();
//workflow.cancel(current); // this doesn't work, if this line is removed the rest of the action works
action.setRedirectURL(current);
current.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 02:41 AM
Hi Suzy,
It is possible to implement a UI action to cancel a workflow.
Quick clarification, have you ensured the 'Client' checkbox is set to true and within the 'Onclick' section you are calling withdraw()
Ensuring these attributes are set, tweak your server function script slightly as follows:
function serverLoanerWithdraw(){
new Workflow().cancel(current);
current.active=false;
current.state=5;
current.update();
action.setRedirectURL(current);
}
To help others, please mark as correct and/or helpful.
Thanks,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 08:06 AM
Hi Suzy,
No worries. As you've implemented this on a custom table you may need to shed some light.
My feeling is by setting it active=false and the state=5 at the same time maybe causing a conflict. Does the table extend task by any chance? Do you have any rules that trigger by setting the record active=false?
Thats where I would start.
Try commenting out the activate=false as you're setting the state anyway.
To help others, please mark correct and/or helpful.
Thanks,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 08:49 AM
Hi Robbie,
Thanks alot!!! it worked I have commented out active=false.
Thanks once again 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 08:00 AM
Hi Suzy,
Just circling back on this. Have you had a chance to implement the changes as per my response?
To help others, please mark as correct and/or helpful.
Thanks,
Robbie