UI Builder Event Handler Condition - Advanced > "Conditionally"

cagg
Tera Guru

***I also have this in the Next Experience forum with no response so adding it here for more visibility***

 

Does anyone know what the "Event handler condition" should accept as a condition? There is no documentation I can find on this, all of the docs for event handling stop short of explaining this.

 

What I am looking for is something like this

@payload.fieldName == 'myFieldName' - execute the event.
 
cagg_0-1677708592515.png

 

 

Thanks, Jim

8 REPLIES 8

JagjeetSingh
Kilo Sage
Kilo Sage

I've not used it but there is a workaround if you didn't find a solution for this.

 

Create a client script and check the condition there. You can access the event payload in client script like below. And then if the condition satisfies then trigger your event from script.

 

const fieldName = api.event.payload.fieldName;

If(fieldName == "VALUE"){
api.emit("YOUR_EVENT_NAME", { "paramOne" : "PASS_VALUE_HERE"});
}
//In your case you'd pass fieldName, value and displayValue params for your event.

 

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

Hi Jagjeet, I appreciate the reply. I have a meeting with HI today to explain why this is not documented and will update the thread here. In the meantime, I will try the above script and see if I can get it to provide the results I need. Always good to have options.

 

Once again thanks, Jim!

This was actually solved using - https://docs.servicenow.com/bundle/sandiego-application-development/page/administer/ui-builder/task/...

 

These are the formulas that the Event Handler Condition expects.

Hey @cagg , how did you solve this exactly, can you give an example?

I tried it using formulas