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

@Gal Katz For me code looked ok but you were getting the issues right so I wanted to check with that.

 

This means this.getParameter() function itself is returning undefined value

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

@Gal Katz I hope the script include is client callable. 

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

yes it is client callable

@Gal Katz I think you missed calling the getXML() function in client script.

 

ga.getXML();

 

Please add that and check once.

 

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

I didn't forget it, it's not there on purpose.
the action is happening in the Script Include and if I just put a string in the query instead of this variable its all working well.