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

from g_form.getValue() I'm getting a value from a choice string field (the value can be '1' or '2' or '3' or '4')

I added ga.getXMLAnswer(getResponse); but I don't need to get a response. for example, if I simply put '1' in the addQuery, I get the result that I want (to filter the Assigned to list).

jaheerhattiwale
Mega Sage
Mega Sage

@Gal Katz Can you please log the sec and post the screen shot what you get in the log?

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

I get undefined

jaheerhattiwale
Mega Sage
Mega Sage

@Gal Katz Please change the variable name from u_sec_class ro secClass in script include as below

 

var secClass = this.getParameter('u_sec_class');

 

Please try this. All your code looks good.

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Thanks but I got the same result. 
by the way why should the variable name matter?