No Preview available for a varaible of type reference field on request item?

sonalin
Tera Expert

find_real_file.png

 

This is a form where we have to get data name of a Computer[cmdb_ci_computer] table. I have written a catalog client script which manges to give the exact value of the Computer Name assigned to the User[sys_user]. However I am unable to get the Preview of the Data. Due to this I cannot see this value in the Requested Item as below:

find_real_file.png

 

Please help me to sort out this. since I have to deploy this as soon as possible.

Appreciate all the help. Thank You.

 

1 ACCEPTED SOLUTION

Hi Sonali,

 

Try using below snippet.

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var empcidetails = g_form.getReference('select_user',setci);
alert('User is '+empcidetails);
function setci(empcidetails)
{
var CIdetails = new GlideRecord('cmdb_ci');
CIdetails.addQuery('assigned_to', empcidetails.sys_id);
CIdetails.query();

while(CIdetails.next())
{
//alert(CIdetails);
//alert('CI is '+CIdetails);
var a=CIdetails.sys_id;
// alert(a);
g_form.setValue('configuration_item',a);
}
}

 

Thanks, 

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

View solution in original post

9 REPLIES 9

sonalin
Tera Expert

Thank a lot for you reply Jaspal, I did tried with the Code which you gave me.

Still no Luck.

find_real_file.png

 

The Code snippet does return me the SysID and alert the Object details however it still do not preview  the CI details.

Hi Sonali,

 

Can you try once by checking the pop up columns once for necessary table.

 

Thanks,

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

Hi Sonali,

 

Try using below snippet.

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var empcidetails = g_form.getReference('select_user',setci);
alert('User is '+empcidetails);
function setci(empcidetails)
{
var CIdetails = new GlideRecord('cmdb_ci');
CIdetails.addQuery('assigned_to', empcidetails.sys_id);
CIdetails.query();

while(CIdetails.next())
{
//alert(CIdetails);
//alert('CI is '+CIdetails);
var a=CIdetails.sys_id;
// alert(a);
g_form.setValue('configuration_item',a);
}
}

 

Thanks, 

Jaspal Singh

 

Hit Helpful or Correct on the impact of response.

Olyn Dabbs
Tera Expert

Hey Sonali,

 

This could possibly be a security issue.  Have you checked the cmdb_ci_computer/read ACL(s)?

 

Thanks,

 

Olyn

sonalin
Tera Expert

Thanks a Lot Jaspal for helping me out to sort this issue.

Appreciating all your help