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

yes I did

newhand
Mega Sage

@Gal Katz 

Finally i found the  addParam api document... and  see below red part.

 

Parameters
Name Type Description
parm_nameStringThe name of the parameter to pass. (The name must begin with the sysparm_ .)
Please mark my answer as correct and helpful based on Impact.

Thanks I tried it but I still get the parameter as undefined in the Script Include

Shekhar Navhak1
Kilo Sage

@Gal Katz  can you replace line 7 in the client script

 

From  --> ga.addParam('u_sec _class', g form.getValue('u_sec_class')) ;

To --> ga.addParam('sysparam_u_sec_class', g form.getValue('u_sec_class')) ;

 

Then your code will work.

 

Please mark the answer correct/helpful based on Impact.
Regards, Shekhar

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.