Save & Request Approval UI Action on Change

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 09:09 AM
Currently we have to save the change record first before the UI Action for approval requests is visible,
This makes sense, as there are some fields, that are only mandatory when approval should be requested - but those are not important as long the state is 'new'.
To make things more user friendly I'd like a ui-action that saves first and then tries to request the approvals. In Case not all fields relevant for approval are there - they should be marked accordingly.
Problem is, if I check the "show insert" the "save" part would be required first, to make the relevant fields for the following stages mandatory.
I assume I would just need on line of code to be able using the "show insert" here ... but for a no/low code person this might be a longer journey to find out 😉
Please advise.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-04-2017 12:03 PM
Hi there,
I used goranlundqvist 's How to hide/show an UI action on field changes to do that.
You will use a UI policy to show and hide the button, and you can add conditions to do it. For example:
Conditions:
state is New
customer is not empty
etc.
And then (execute of true):
function onCondition() {
$$('#state_model_request_cab_approval')[1].show();
}
(execute of false):
function onCondition() {
$$('#state_model_request_cab_approval')[1].hide();
}
Hope this helps. If you need assistance, let me know.
Harel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:33 AM
Not really what I was looking for. But maybe helpful on other forms. Thank you.
Here I wan to show that an approval can be triggert .... so the ui action should be visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 03:07 AM
If the UI action should be visible on when an can be approval triggered, then I think it is what you need because you can set it up so that only after all relevant fields are populated, the Request Approval button is shown.
Other than that, you can show the approval button straight from New, only add a few alert lines under the moveTo Authorize function. For example:
var comments = g_form.getValue('comments');
if(comments =='') {
alert('Comments are mandatory before requesting approval');
return false; //this will stop the request from getting submitted
}
And so on for your mandatory fields.
If that's still not what you need, please explain.
harel
Please mark as correct or helpful based on impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 03:16 AM
We have different stages ... so FIRST it has to be new before if can go to approval requested. This is ok like this.
And "new" requires less mandatory fields than approval requested.
So the current situation is that u can submit via ui-action or save. Than stage is "new" and the UI Action for requesting the approval is available.
What I want is a request approval ui action available also on insert, that (in the background saves the record first (> new) and then tries to move it to approval requested. In case mandatory fields required for the approval are not set - you have to fill them (but state then is already 'new').
Please see conditions in the current ui-action (see initial screenshot).
Thank you!