- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 10:06 PM
I create a variables "NON EXT T" in MRSV use Reference Qualifier : javascript:'u_incident=' + current.variables.u_incident_t; as below:
The data like this :
In the Record Producer, When i choose Incident T(u_incident_t) = "INC0010019", it's should show 2 record TESN0001024, TESN0001023, but it's not ! Please help me ! Thank you so much
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 10:40 PM - edited 11-01-2023 10:42 PM
Hi @Dinh Nguyen
Unfortunately current.variables will not work in reference qualifier in MRVS.
This is how we achieved it using gs.getSession();
Use Case : We have catalog item having
A. Variable on Catalog form
Type : Reference => User (sys_user) table
Name : Requested for
B. MRVS contains below variable
Type : Reference => Hardware (alm_hardware) table
Name : Asset id
So, depending upon Requested for "hardware" related to him should get populated in MRVS variable "Asset id"
Solution :
Step 1 : Create client callable script include to store session data
/*Function to get session details*/
setSessionValues: function() {
var user = this.getParameter('sysparm_user');
var session = gs.getSession();
session.putClientData('requested_for', user);
var clientData = session.getClientData('requested_for'); //this will be used in reference qualifier
gs.info(clientData);
return clientData;
},
Step 2 : Write onLoad client script in MRVS
** onLoad client script should be in MRVS
function onLoad() {
/*Get Requested for from Catalog form*/
var req_for = g_service_catalog.parent.getValue('requested_for');
/*Call GlideAjax and store the session Value*/
var grSession = new GlideAjax('MVRS_Session'); //script include name
grSession.addParam('sysparm_user', req_for); //
grSession.addParam('sysparm_name', 'setSessionValues');
grSession.getXMLAnswer(callback);
function callback(answer){
g_form.addInfoMessage('answer=' + answer);
}
}
Step 3 : Add reference qualiifier
javascript:'assigned_to=' +session.getClientData('requested_for')
That's it....!!!
You can adjust your code,variables as per your requirement...!!
Hope this helps...!!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2023 10:40 PM - edited 11-01-2023 10:42 PM
Hi @Dinh Nguyen
Unfortunately current.variables will not work in reference qualifier in MRVS.
This is how we achieved it using gs.getSession();
Use Case : We have catalog item having
A. Variable on Catalog form
Type : Reference => User (sys_user) table
Name : Requested for
B. MRVS contains below variable
Type : Reference => Hardware (alm_hardware) table
Name : Asset id
So, depending upon Requested for "hardware" related to him should get populated in MRVS variable "Asset id"
Solution :
Step 1 : Create client callable script include to store session data
/*Function to get session details*/
setSessionValues: function() {
var user = this.getParameter('sysparm_user');
var session = gs.getSession();
session.putClientData('requested_for', user);
var clientData = session.getClientData('requested_for'); //this will be used in reference qualifier
gs.info(clientData);
return clientData;
},
Step 2 : Write onLoad client script in MRVS
** onLoad client script should be in MRVS
function onLoad() {
/*Get Requested for from Catalog form*/
var req_for = g_service_catalog.parent.getValue('requested_for');
/*Call GlideAjax and store the session Value*/
var grSession = new GlideAjax('MVRS_Session'); //script include name
grSession.addParam('sysparm_user', req_for); //
grSession.addParam('sysparm_name', 'setSessionValues');
grSession.getXMLAnswer(callback);
function callback(answer){
g_form.addInfoMessage('answer=' + answer);
}
}
Step 3 : Add reference qualiifier
javascript:'assigned_to=' +session.getClientData('requested_for')
That's it....!!!
You can adjust your code,variables as per your requirement...!!
Hope this helps...!!!
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2025 01:03 PM
Thanks