Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Sample code for onChoiceCreate Transform Map script

Ashwini Priyadh
Tera Expert

Hi There, 

 

I am trying to use onChoiceCreate transform script to create choices for the field, but need help with the sample code for the below syntax,

var e = new GlideEvent("myimport_ChoiceCreate", action, value, "");
e.insert();

 

What we should be passing in the parameters to create a choice... 

 

Appreciate your help!!

Thank you,

Ashwini Y

1 REPLY 1

Rahul Priyadars
Tera Sage

i do not think u need to pass values.

onChoiceCreate runs before a new choice is created on a choice field. Since this script runs when a choice is created, “create” has to be selected as the choice action for that field map. If it is not selected, the script will not run. Because onChoiceCreate is a before action, only the source table record has set values.

Regards

RP