- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 03:54 AM
Hi, I've a Reference field and I want to use dynamic reference qualifier in him. So I've to create a Dynamic Filter Option, and a Script include that return a string query.
My problem is I can't get the value of a field in record producer called "u_hotel_spirit_code". That field is Reference too.
current.u_hotel_spirit_code --> Don't work
producer.u_hotel_spirit_code --> Don't work
g_form.getValue('u_hotel_spirit_code') --> Don't work
Someone could help me?
Script Include:
Dynamic Filter:
The second must be filtered by the first:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 07:21 AM
I found here the answer: https://community.servicenow.com/message/760842#760842
To access the variables on server-side, you've to use "current.variables.variableName".
In my case: "current.variables.u_hotel_spirit_code".
My Dynamic Filter Option now:
My Script Include now:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 05:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 05:03 AM
Why you are using dynamic here, use advance here and add same line in Refernce Qualifier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 04:27 AM
Hi,
Try gs.addInfoMesage(producer.u_hotel_spirit_code) and see what it returns. Since its a reference field it should return the sys_id of the record it is refering to.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 04:44 AM
The message not show. If I try "gs.addErrorMessage(current.u_hotel_spirit_code);" it shows "undefined".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2016 05:08 AM
Hello Sergio,
From the script, I can understand that you are just calling the script include without any parameters.
try like this, in the dynamic reference qualifier: javascript: new CompanyFilter().byLocationAndVendorType(producer.u_hotel_spirit_code);
On the script include end: Change the function name like this
byLocationAndVendorType: function(obj){
gs.print(obj);
//obj is your hotel spirit code.
},