Choice Selection from Reference Qualifier returns empty in Script Include when passing current
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2024 02:33 PM - edited ‎10-17-2024 02:34 PM
Hello,
I have a catalog item, and within the catalog, there is a specific variable that needs a reference qualifier. When building the reference qualifier, I am passing the current object. Within the Script Include, I am unable to access the value selected from a specific variable. The variable is a select box type with 2 choices.
My reference qualifier is very simple:
javascript: new getAssetInfo().returnQuery(current);
My script include is also simple:
getAssetInfo: function(current) {
var type = current.variables.type; // Select Box with 2 choices
var user = current.variables.requested_for; //Reference field that returns sys_id
gs.info("type: " + type); //returns empty
gs.info("type: " + user); //returns sys_id
}
I am able to access the request for from current, but the select box is not outputting any data.
I've also tried current.variables.type.getDisplayValue() and that did not return anything
Anything Helps!
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2024 02:53 PM
That reference qualifier can't work with that Script Include as the name of the SI needs to be getAssetInfo with a function named returnQuery, following the reference qualifier format. Beyond that, I tried this in my PDI and was surprised it worked as 'type' is not the best choice for a script variable name since it could be a system/reserved word. Are you certain 'type' is the variable name - no extraneous spaces or mis-spellings?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2024 03:06 PM
Thanks for your reply and my apologies the function name is returnQuery within the script include. Was just a typo.
can you please provide an example of what you did in your PDI? My select box value is empty within script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2024 03:52 PM
var refQualUtils = Class.create();
refQualUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getVars: function(current) {
var type = current.variables.type;
gs.addInfoMessage(type)
return
},
type: 'refQualUtils'
});