UI Policy with setValue not setting the correct value

matthew_hughes
Kilo Sage

I've got the following UI policy for a catalogue item that is used to update the value of a certain field when the conditions are met:

 

matthew_hughes_0-1707835977829.png

 

The script of the UI Policy is:

matthew_hughes_1-1707836042535.png

 

However, what I'm finding is that if I go onto my catalogue item and trigger the UI Policy, it's not setting the to field to Not Applicable, but Read Only:

 

matthew_hughes_2-1707836126198.png

So I was just wondering if anyone knows why the text specified in SetValue is not working as it should?

 

 

 

11 REPLIES 11

_Gaurav
Kilo Sage

Hi @matthew_hughes 
Seems like you are using the setValue to the choice field, so make sure you're using the backend value to set the value in the field.
g_form.setValue('u_toxic.......' , 'not_applicable'); //make sure to write the backend value here

 

Also, make sure the UI policy is working. To check please add the alert to confirm and disable the ui policy action

 

Please mark helpful if this resolves your query
Thanks!
 

Hi @_Gaurav 

 

Hi @Community Alums 

 

I've now made two UI Policies:

 

matthew_hughes_0-1707899154976.png

 

matthew_hughes_1-1707899193823.png

 

Whilst it does make the field Read only when it correctly should, it's not adding the value of 'Not Applicable'

 

 

Hi @matthew_hughes 

u_toxic field is a choice field, so why don't you add the choice question under the field itself and try to set the value from the UI Policies?


I've added the choice back in, but when I don't want it to appear, it's started appearing:

 

matthew_hughes_0-1707899855523.png

 

I don't want it to show in this scenario