The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to make the ui policy work without form load when the condition of UI policy is satisfied.

Snehal Madakatt
Mega Sage

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:

SnehalMadakatt_0-1702561213709.png

 

Regards

Snehal 

5 REPLIES 5

Brad Bowman
Kilo Patron
Kilo Patron

Try this as a Data Policy first.  This should cover your scenario and not rely on the UI for enforcement.

SunilKumar_P
Giga Sage

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.

Hi Sunil,

 

Field is there on the form. But it works once the page is reloaded.

Rushikesh
Tera Expert

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!!