- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 03:12 AM
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:
Please help me to sort out this. since I have to deploy this as soon as possible.
Appreciate all the help. Thank You.
Solved! Go to Solution.
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 08:07 AM
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.
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2018 02:37 AM
Hi Sonali,
Can you kindly help with the script once & confirm if the record is actually present in the table being referenced.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2018 10:55 PM
Hello Jaspal,
Yes The Record is already present on the Computer[cmdb_ci_computer] Table.
Below is the script I am using to display this Value. I also tried using the [cmdb_ci] table. Still no luck.
This CI Reference value is not getting displayed to the Variable Configuration Item, however when I update the status value in the workflow, the run-script successfully updates the status.
function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
   //Type appropriate comment here, and begin script below
    if (newValue) { 
    
    var empcidetails = g_form.getReference('employee_user_name');
    var userID = empcidetails.user_name;
        
        var CIdetails = new GlideRecord('cmdb_ci_computer');
                CIdetails.addQuery('assigned_to', newValue);
                CIdetails.query();
        
        while(CIdetails.next())
{
//g_form.setValue('cmdb_ci', ci.name);
    g_form.setValue('configuration_item', CIdetails.name);
    
}
      
    }
    
            
}
 
					
				
		
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 01:28 AM
Hi Sonali,
Can you try something as below.
function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
   //Type appropriate comment here, and begin script below
  //  if (newValue) { 
    
    var empcidetails = g_form.getValue('employee_user_name');
alert('User is '+empcidetails);
 var CIdetails = new GlideRecord('cmdb_ci_computer');
                CIdetails.addQuery('assigned_to', empcidetails);
                CIdetails.query();
        
        while(CIdetails.next())
{
alert('CI is '+CIdetails);
    g_form.setValue('configuration_item', CIdetails);   
}
      
  //  }
    
            
}
Kindly confirm the alerts what you get.
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2018 12:52 AM
Hi Jaspal,
If we see the configuration Item on the Incident from, there seems to be reference qualifier and the value is refereed from Task table. Do we need to create a reference qualifier for this?
Thanks,
