UI action redirection to previous page issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2020 05:02 PM
we have a UI action Cancel Task on workorder table when clicked it should make the reason for cancellation field mandatory and visible and if entered then it should set the state to cancel, but when I click on the UI action it is redirecting to the previously worked (used page) , not sure how to debug this and it is also not updating the record.
Below is the UI policy to hide the field
UI action :
Script:
function checkReason() {
g_form.setDisplay("u_cancel_reason", true);
if (g_form.getValue('u_cancel_reason') == '') {
g_form.setMandatory("u_cancel_reason", true);
gs.addErrorMessage("a change task must be added before submitting the change");
//alert('Please enter the reason before cancellation');
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'cancel'); // give the action name of your UI Action
}
if (typeof window == 'undefined')
serverResolve();
function serverResolve() {
new global.StateFlow().processFlow(current, 'ffc7a360d7230100fceaa6859e6103ae', 'manual');
//Moving redirect from state flow to UI action
action.setRedirectURL(current);
}
When clicked on the UI action , cancel reason will be mandatory and if selected , there is a OOB in UI action which will enforce worknotes mandatory ,
This is the OOB code
new global.StateFlow().processFlow(current, 'ffc7a360d7230100fceaa6859e6103ae', 'manual');
//Moving redirect from state flow to UI action
action.setRedirectURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2020 07:59 AM
Try adding an info message inside each of those two IF blocks that wrap the current.update() statement to see if the system goes inside those blocks or not.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2020 08:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2020 08:29 AM
My suggestion was to add debug messages in the Script Include, not in the UI Action. In the UI Action you don't need current.update() at all.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2020 08:38 AM
Thanks for that , but as the UI action is not performing the basic update to a field ,that's the reason I am trying in UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2020 09:03 AM
As this is working in My PDI and not working in Work , after validating the UI action condition , "(new global.StateFlow().validFlow(current, 'ffc7a360d7230100fceaa6859e6103ae', 'manual'));"
When I check the Script include I see some code that it is checking the roles , how do I know what roles I need to have for this to execute ?