Help with an Advanced Reference Qualifier & Client Script for MRVS

Lon Landry4
Mega Sage

Can someone help me with an Advanced Reference Qualifier & Client Script for MRVS?
I believe the syntax is correct, so it must be something else...


I am trying to create an Advanced Reference Qualifier in the global scope for a catalog item, that removes an option (record) from MRVS query if already selected. I am getting the data I need, and I believe it is available when I need it.

 

What I know:

  • I have tested using alerts & am currently copying the list of MRVS records to a placeholder variable in the MRVS.
  • A sys_id or list of sys_id s are captured in a place holder field.

I have tried using the following variable types for a placeholder variable:

  • Single line text returns list of Sys Ids separated by a comma.
  • Multiline text returns list of Sys Ids separated by a comma.
  • Reference is empty.
  • List collector returns list of display_name s separated by a comma.


onLoad Client script (Isolate script is false)

function onLoad() {
//Get whole JSON payload from MRVS
var inList = g_service_catalog.parent.getValue('u_returning_asset_submitted_for');
//If MRVS is not empty
if (inList !=''){
//Create a placeholder/test variable
var testInList = inList;
//Create a variable to handle regex with name of MRVS variable value to extract
var regexInList = /assets_assigned_to_submitted_for":"(.*?)"/g;
//Add data retuned from regex to an array
var dataInList = [];
//loop thru MRVS data & return Sys IDs in a comma seperated list
var checkInList;
while(checkInList = regexInList.exec(testInList)){
dataInList.push(checkInList[1]);
}
sessionStorage.setItem('assets_i_certify_filter',dataInList);
g_form.setValue('first_list_of_assets',dataInList)
}
//if MRVS is empty then do nothing
else{return;}
}

 

Advanced Reference Qualifier

javascript(and colon)'install_statusNOT IN7,8,17,^model_categoryNOT LIKEvm^model_categoryNOT LIKEServer^display_nameNOT LIKEvmware^assigned_to!=ddbd343f375acf809bfbdaa543990ea5^sys_idNOT INcurrent.variables.first_list_of_assets;^assigned_to=' + current.variables.tb_submitted_for;

 

Illustration of issue

Example of issue illustrated.
1. Initial list displayed to user inside of MRVS.
mrvsIssue2.png

2. User selects an option (Ex. Apple)
3. The next time uses selects Add, the option (Apple) is still in list.

mrvsIssue1.png

5 REPLIES 5

@Lon Landry4 
You can also go through my MRVS article which has some useful scenarios.

 

Thanks,
Murthy