Is there a way in java script to trigger the Event Handler Success or Failure? It is easier sometimes to use the GUI under where the code is written to trigger events. I included a simple block of code.
However, this block of code will always be successful.
I purposely want it to trigger failure or a success.
function myError() {
let a=1;
if(a==1){
Event handlers: Success // What do I code here?
}
else{
Event handlers: Failure // What do I code here?
}
}
Not sure if this is what you're looking for, but you can use Java Script to trigger a query and define Success or Failure events directly via the code.
Here's an example I provided to another user recently:
Ah okay - I see what you're trying to do, @clay123. You can deterministically trigger the Failure event handler by throwing any error from which the JS block.
function helloWorld() {
let a = 1;
if (a === 1) {
// do something
} else {
throw new Error()
}
}
return helloWorld();