- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2016 11:59 PM
Hi,
I am stuck in a tricky situation. I have a button on RITM form that opens a Service Catalog in a Dialog Window. I want variables in Window to be populated by variables of RITM.
UI Action is Client and has below code to get variables from RITM, but that does not work.
var z = current.variables.u_customer_name;
var x = g_form.getValue('number');
var gr = new GlideRecord("sc_req_item");
gr.addQuery('number', y);
gr.query();
if (gr.next()) {
y = gr.variables.u_customer_name;
}
z and y are returning Undefined values. Is there any other way to call RITM variables from UI action?
I did a lot of research on this, but couldn't find a solution.
The form looks like this:
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 12:04 AM
I figured this out. It's not possible to call variables directly from client UI action, so I had to use a GlideAjax to get the variable values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 12:14 AM
Hi Anuraj,
Can please provide more clarification on the script..
Customer name is reference field or just string. In the above code, the y denotes number or customer name because first you have used y as number then assigning it to a customer name.
Thanks
Gopinath L
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 12:26 AM
Hi,
Yes that's my bad, look at the updated (incomplete) code:
function cloneRequest() {
//var z = current.variables.u_customer_name; //saving variable value using current
var x = g_form.getValue('number');
var gr = new GlideRecord("sc_req_item");
gr.addQuery('number', x);
gr.query();
if (gr.next()) {
var y = gr.variables.u_customer_name; //saving variable value using gliderecord object
}
var changeDialog = new GlideDialogForm('Catalog Form','com.glideapp.servicecatalog_cat_item_view');
changeDialog.addParm('sysparm_id', 'bb19c616dba5220044e4fabdbf961924');
changeDialog.setLoadCallback(function(iframeDoc) {
var dialogFrame = 'defaultView' in iframeDoc ? iframeDoc.defaultView : iframeDoc.parentWindow;
var interval;
var count = 0;
interval = setInterval(function() {
try {
if (dialogFrame.g_form) {
dialogFrame.g_form.setValue('u_customer_name',y); //setting value using y
//dialogFrame.g_form.setValue('u_customer_name',x); // setting value using x
u_customer_name is a variable from RITM that has to be saved on pop-up window form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 12:04 AM
I figured this out. It's not possible to call variables directly from client UI action, so I had to use a GlideAjax to get the variable values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2018 05:30 AM
Hello,
Can you help me out with the below script using GlideAjax? I'm trying to call the variable value for that but I'm not successful.
var a = new GlideRecord('sc_req_item');
a.addQuery('sitename','current.variable.sitename');
a.query();
while(a.next())
{
b = a.variable.sitename;
gs.print(b);
}