- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 12:41 AM
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.
 
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2022 12:05 AM
I'm updating that I instead of using the parameter I wrote a workaround and just used current.u_sec_class in the query.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2022 04:08 AM
@Gal Katz in that g_form.getValue() is not returning you anything.
Please add an alert on top before GlideAjax call as below
alert(g_form.getValue('u_sec_class'));
if you don't get anything in alert then please check the value in that field.
If you get alert correctly then please store the value in some variable and then pass to glideajax as below
var secClass = g_form.getValue('u_sec_class');
then
ga.addParam('u_sec_class', secClass.toString());
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 02:01 AM
Sorry for the delay. I was working on a more urgent project.
In the Client Script I do get the value, but in the Script Include when I get the parameter its undefined for some reason.
I also tired to store the value in some variable and then pass to GlideAjax as you advised but without success.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 02:08 AM
@Gal Katz Please update the first parameter to addParam function as below this should definitely fix the issue.
The first parameter should start with sysparm_
ga.addParam('sysparm_sec_class', g_form.getValue('u_sec_class'));
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 03:37 AM
sorry. same result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 03:44 AM
@Gal Katz In script include have you used sysparm_sec_class in this.getParameter function?
ServiceNow Community Rising Star, Class of 2023