We are currently experiencing intermittent login issues on Community. The team is actively working on a fix.

sys_id of the catalog variable to be used in reference qualifier.

Arnab2
Kilo Contributor

Hi,

I have a look up select box variable for a catalog item. It is referring to a custom table. I am using a reference qualifier to populate the choices. How can I pass the sys_id of this select box as a parameter to a script include via reference qualifier? I don't want to hard code the sys_id. Is there a way to achieve this?

Using current.sys_id will fetch me the catalog item's sys_id. I need the sys_id of the variable for which I am setting the options.

 

Thanks and regards,

Arnab Dash

9 REPLIES 9

The problem with this script is it will fail if there are more than one variables with same 'question' for a catalog item.

Isn't there any property out there which can provide the sys_id of the variable?

Not that I could see- but why go to this extent? Since you're passing the unique identifier for the variable to your script include, why not pass some string value that you then use in your script include to determine the appropriate query to run? Alternately - can you achieve the same needs by making the reference qual field use an encoded query instead?

ccajohnson
Kilo Sage

It is unclear what you are tying to achieve. You mention you have a lookup select box and the selected value is what is needed. Is this to be used in a second lookup select box, or something else? If you are using your script include for filtering on the second lookup select box and you want to put in the value from the first variable, you can do so using a syntax similar to the following:

javascript:new global.scriptIncludeName().filterFunctionName(current.variables.first_variable);

Let us know how you have your lookup table defined as well as your script include used for filtering so we can narrow our solution accordingly.

I am not retrieving any variable's value. I have a look up select box 'X'. I want to pass the 'sys_id' of 'X' via 'X's' reference qualifier to a script include.

Is there a way we can do it? The script that I am currently using in X's reference qualifier i.e. current.variables.X.sys_id doesn't work.

I hope it's clear what I am trying to achieve.

 

Regards,

Arnab

I think the main question we're trying to get to is why the sys_id of that particular variable matters. For example, I could have three variables on my form all referencing the same table (which I'm assuming this is why you feel you need the sys_id), but if I'm calling a script include that I've written, then I can write that function to accept any parameter to make decisions as to how to return the right values. So, instead of:

javascript: mySI().myFunction(thisVarSysID);

I could do something like:

javascript: mySI().myFunction('stringThatHelpsMyFunctionLogic');

In the function, then instead of using the sys_id for determining how to filter the table, I can work in the string.

The other question is if a script include is absolutely necessary. Can you not put the filter itself, like this example reference qual from one of our variables:

javascript:'sc_catalog='+current.variables.sc_catalog