UI Policy & field color

rickw1
Giga Contributor

So, this is an issue I'm facing at the moment:

I like the condition formatter of UI Policy, but instead of making a field mandatory or read only, I just want to set a background color for those fields.

Would this be possible in an easy way?

2015-08-28_16-28-53.png

Desired result:

Both background colors: orange

12 REPLIES 12

David OBrien
Kilo Guru

You can use a script in your UI policy to set the background color.   The example below would work for the Incident table to set the Caller ID background color to Orange via UI policy.   Just set it in your Execute if True script.



var callerField = $('sys_display.incident.caller_id');


callerField.setStyle({backgroundColor : "orange"});


David O'Brien (Cloud Sherpas) schreef:



You can use a script in your UI policy to set the background color.   The example below would work for the Incident table to set the Caller ID background color to Orange via UI policy.   Just set it in your Execute if True script.



  1. var callerField = $('sys_display.incident.caller_id');  
  2. callerField.setStyle({backgroundColor : "orange"});  


Thanks David.


I got it working when using an alert.


Color is still not working unfortunately.


Getting this error:



onChange script error: TypeError: $ is not a function function (){var o=i(m,arguments);return l.apply(n,o)}




My script:


function onCondition() {


      var commField = $('sys_display.x_medt2_ihs_it_support_request.team');


      commField.setStyle({backgroundColor : "orange"});


      alert("The communication template does not match with the assigned group!");


}


You're running this on table x_medt2_ihs_it_support_request, correct?   That looks to be a custom table.   Does the table name actually have a u_ before it?


x_ indicates a scoped app.   No u_ necessary.