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

UI Action vs relevant Business Rule ... how to set order correctly?

Zod
Giga Guru

HI,

somehow I stuck.

I have a Business Rule that need to check if field A or field B is set. Both is ok. This is relevant if status is INSTALLED.

Now I do have a UI action that will DEINSTALL the record - meaning setting all field values to blank and the status to DEINSTALLED.

Now the Business Rule is blocking the UI Action to be executed, as the status still is INSTALLED when trying to execute the UI ACTION.

Important is, that I need the system to only have ONE Update to be done ... so changing the state first and changing the values of the fields in a second step is no option due to automatic updates that need to be triggered in one step due to legacy system ...

I think this a minor issue I'm not aware of to solve this issue ... . As the issue is a little bit more complex that I'm describing here .. I'd like to somehow stick to the BR and anyhow run the UI Action ...

thank you

1 ACCEPTED SOLUTION

Sounds like this is a client side UI Action then, and I see from your code that this is correct.   You need to change the UI Action to run on the server side.   This will allow the code to do what it needs regardless of ACL's.



You will not be able to do a confirm as you currently are.



The other option that you have is removing the ACL and adding a UI Policy to make the field read only.


View solution in original post

9 REPLIES 9

DrewW
Mega Sage
Mega Sage

Can't you just add a condition to the Business rule says and status != deinstalled so its skipped when you click the UI Action???


The problem is, that this is not working.


It only runs when status is INSTALLED.


But the UI action does the "transformation" of the fields and chaning the state to DEINSTALLED ... while obviously the state is not yet changed .. so the BR is blocking the action ... I get an invalid update and the message from the business rule ...


So the BR has a condition of state=installed and it is running even if the state is not installed?   Can you post a screen shot of your condition and code?


I run the UI Action on a record that is status INSTALLED. The UI Action should change the state to DEINSTALLED and clear out other fields too .. . But while running the ui action, the condition of the BR become active, as field A & B will be empty.



The UI action looks like this .. .



function deinstall123(){


var txt;


txt="Are you sure?";


var r = confirm(txt);


if (r == true) {


g_form.setValue('u_status',deinstalled);


g_form.setValue('u_field_a','');


g_form.setValue('u_field_b','');


// ...


g_form.submit();


//...


}


}



The BR condition checks if field A & B is empty and status is installed ... on before insert/update