How to make the ui policy work without form load when the condition of UI policy is satisfied.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 05:40 AM
Hi team,
I am facing one issue on Compliance workspace with UI policy.
Scenario: When the state changes to 'Approved' from backend(via flow), certain form fields should become read only.
But on workspace the fields are editable, once the form is reloaded, then the fields become editable.
If end user might not manually reload at that moment, and as its editable, he may make changes to the field value.
So any workaround or solution to handle this? I was thinking to force reload the page when state changes to 'Approved', so the UI policy will run and make the fields read only and user will not make changes to the fields.
Below is already set on UI policy:
Regards
Snehal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 05:52 AM
Try this as a Data Policy first. This should cover your scenario and not rely on the UI for enforcement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 06:12 AM
Hi @Snehal Madakatt , Does the form have state field on it? If yes, though the field value gets changed from backend, it will display system has modified this field value (at state field) and the state value automatically changes to Approved, making UI policy actions to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 07:55 PM
Hi Sunil,
Field is there on the form. But it works once the page is reloaded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2023 09:15 PM
Hello @Snehal Madakatt
1. The UI policy the condition should be State CHANGES TO Approved.
2. Select the view for your Compliance Workspace
3. UI policy should be OnLoad true
4. Do not create UI Policy action instead you can add the script in Run Script section
If UI Policy condition evaluates true add below script and If UI Policy condition evaluates false just make the readonly false
// While loading the Compliance workspace you will get the workspace name. In my case it is sow (Service Operation Workspace).
var url = top.location.href;
alert(url);
if (url.indexOf('sow') == 1) {
alert("in if");
g_form.setReadOnly('your_field', true);
}
Please mark it as helpful if my answer has helped with your question.
Thank You!!