Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Reference qualifer with current.variables returning undefined value

Sagar Rd
Tera Contributor

Hi 

 

I am using a reference qualifier condition on a variable in the multi row variable set "javascript: new global.skilUtil().getUser(current.variables.requested_for);" and requested_for is a variable but the current.variables.requested_for is actually sending undefined value. Could you please help me is there anything wrong and need to be changed.

 

Thankyou

2 ACCEPTED SOLUTIONS

Chaitanya ILCR
Mega Patron

Hi @Sagar Rd ,

The current in the MVRS refers to just the MVRS.

you can refer to the Scenario 2 in the below blog and create a onload client script on the MVRS and store the 

requested_for value as a session client data and give it a unique name

 

https://www.servicenow.com/community/now-platform-articles/yes-you-can-effectively-set-or-update-a-r...

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

Medi C
Giga Sage
Giga Sage

Hi @Sagar Rd,

 

Try this:

  1.  Adjust your reference qualifier: (Please use your requested_for variable name)

 

javascript: new global.skilUtil().getUser(session.getClientData("requested_for"));​

 

 

  •  Create OnLoad Catalog Client Script on your Variable Set:

 

function onLoad() {
    var catItemVarName = 'requested_for'; //PLEASE REPLACE THIS WITH YOUR REQUESTED FOR TECHNICAL NAME
    var catItemVarValue = g_service_catalog.parent.getValue(catItemVarName);
    var ga = new GlideAjax('RefQualifierClient'); // PLEASE USE THE SCRIPT INCLUDE WHICH IS CREATED IN NEXT STEP
    ga.addParam('sysparm_name', 'setSessionData'); //function in script include
    ga.addParam('sysparm_cat_item_var_name', catItemVarName);
    ga.addParam('sysparm_cat_item_var_value', catItemVarValue);
    ga.getXMLAnswer(getResponse);
}

function getResponse(response) {
    //do nothing 
}​

 

 

  • Create a Script Include (Client Callable / Glide AJAX enabled) - In my example, I named it "RefQualifierClient"

  • Add the following function to your script include:

 

    setSessionData: function() {
        var catItemVarName = this.getParameter('sysparm_cat_item_var_name');
        var catItemVarValue = this.getParameter('sysparm_cat_item_var_value');
        var session = gs.getSession().putClientData(catItemVarName, catItemVarValue);
        return;
    }

 

I hope it helps!


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

View solution in original post

6 REPLIES 6

Vishal Jaswal
Giga Sage
Giga Sage

Hello @Sagar Rd 

Try below:

 

javascript: new global.skilUtil().getUser(current.row.requested_for);

 

 

 


Hope that helps!

HI @Vishal Jaswal 

 

Thanks for the response, it still undefined below is the reference qualifier -- javascript: new global.skilUtil().getUser(current.row.requested_for);

 

Thank you

Chaitanya ILCR
Mega Patron

Hi @Sagar Rd ,

The current in the MVRS refers to just the MVRS.

you can refer to the Scenario 2 in the below blog and create a onload client script on the MVRS and store the 

requested_for value as a session client data and give it a unique name

 

https://www.servicenow.com/community/now-platform-articles/yes-you-can-effectively-set-or-update-a-r...

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Thankyou @Chaitanya ILCR