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.

Parameter to String

Gal Katz
Kilo Sage

In Script-Include: I'm getting a parameter from Client-Script (I used g_form.getValue() on a String Choice Field to get the value and send it to Script Include).

I need to insert a string to the query but for some reason I can't convert the parameter to string (in addition to what is shown in the image below, I tried:    sec = u_sec_class.toString()     without success)

Please advise.

Screenshot_20221219_102458.png

 

1 ACCEPTED SOLUTION

Gal Katz
Kilo Sage

I'm updating that I instead of using the parameter I wrote a workaround and just used current.u_sec_class in the query.

View solution in original post

24 REPLIES 24

newhand
Mega Sage

@Gal Katz 

What is the return value of  "this.getParameter('u_sec_class')"  ?

And can you also post your code which calls the script include?

 

Please mark my answer as correct and helpful based on Impact.

I thought the return value is a string but apparently it isn't and I can't convert it to string. that's my issue.
the Client Script is below

Screenshot_20221219_110416.png

 

@Gal Katz 

Add the below debug code atfer getParameter and run again, then check the system log .

 

gs.info(u_sec_class)

gs.info(typeof(u_sec_class))

Please mark my answer as correct and helpful based on Impact.

Ankita19
Tera Guru

can yoy let us know  what you get from g_form.get Value();

and please add ga.getXMLAnswer(getResponse); in your script