- 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-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-17-2022 08:05 AM
Hi Robbie,
Thanks for your reply, it's working as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2022 09:07 AM
No worries. Glad it worked. Thanks for letting me know and also marking my response correct. This will help others with the same question.
Thanks,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-18-2022 07:57 AM
Hi Robbie,
Thanks for that, i have small issue here. Everything is working but the state is not updated correctly.
Please suggest
Thank you.