How to restrict the user to return to previous states?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2022 11:36 AM
Hello! I have a requirement that I have a state field which is a dropdown with different states. The idea is that when I change states, it doesn't let me go back to the previous ones. I thought about solving it with a business rule, but should I make a script for this? Or could I just do everything with conditions? any ideas?
- Labels:
-
Multiple Versions
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2022 11:51 AM
Hi Rocio,
The other option is to use a Client Script ( onChange - on the state field).
Than you can compare newValue with oldValue and you can revert the value in the form when the combination is not allowed.
Best Regards,
Marcin
If my answer helped you in any way, please mark this answer as helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2022 07:07 AM
Hi Rocio,
try below on change client script on state field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var gr = g_form.getValue('state');
if (gr == '-5'){
g_form.addErrorMessage("state can't be changed back to pending");
return true;
}
else
return false;
}
Please mark helpful if the proposed solution is what you are expecting.