Highlighted
Absent Member.
Absent Member.
281 views

outbound javascript only to update record in other tool from HPSM

Jump to solution

Hi Team,

Can anyone give me sample script to call only "update" action  for Incident Management module.

 

Regards,

Zafar

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.
I have created below Insert script and its working fine.
But want to call update, and to update need to compare the field in HPSM with sys_id in servicenow.
Can anyone edit this script using to compare the condition.
like 
If( ticket.numbersysid == myRequest.sys_id.getValye())
then only update should happen?
ANyone please?
 
var updateIncident = new lib.ServiceNow_incident.ServiceNow_incident();
var myRequest = new lib.ServiceNow_incident.insert();
 
myRequest.description.setValue( "Test from HPSM ok" );
myRequest.short_description.setValue( "Test from HPSM okie " );
myRequest.work_notes.setValue( "Test from HPSM" );
myRequest.category.setValue( "Reset" );
myRequest.assignment_group.setValue( "Austin" );
myRequest.cmdb_ci.setValue( "SASP28BR" );
myRequest.caller_id.setValue( "Zubin Parikh" );
 
 
 try
 {  
   
  var updateResponse = updateIncident.invoke( myRequest );
  
  if ( updateResponse.isFault() )
  {
    print( updateResponse.faultstring.getValue() );
  }
  else
  {
    var result = updateResponse.sys_id.getValue();
      print("Sys id is "+result);
 
    if ( result.Error.Desc.getValue() != null )
    {
      print( result.Error.Desc.getValue() );
    }
    else  
      print( "That address is in " + result.number.getValue());
  }
 }
 
catch( e )
{
  print( e.toString() );

View solution in original post

0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.
I have created below Insert script and its working fine.
But want to call update, and to update need to compare the field in HPSM with sys_id in servicenow.
Can anyone edit this script using to compare the condition.
like 
If( ticket.numbersysid == myRequest.sys_id.getValye())
then only update should happen?
ANyone please?
 
var updateIncident = new lib.ServiceNow_incident.ServiceNow_incident();
var myRequest = new lib.ServiceNow_incident.insert();
 
myRequest.description.setValue( "Test from HPSM ok" );
myRequest.short_description.setValue( "Test from HPSM okie " );
myRequest.work_notes.setValue( "Test from HPSM" );
myRequest.category.setValue( "Reset" );
myRequest.assignment_group.setValue( "Austin" );
myRequest.cmdb_ci.setValue( "SASP28BR" );
myRequest.caller_id.setValue( "Zubin Parikh" );
 
 
 try
 {  
   
  var updateResponse = updateIncident.invoke( myRequest );
  
  if ( updateResponse.isFault() )
  {
    print( updateResponse.faultstring.getValue() );
  }
  else
  {
    var result = updateResponse.sys_id.getValue();
      print("Sys id is "+result);
 
    if ( result.Error.Desc.getValue() != null )
    {
      print( result.Error.Desc.getValue() );
    }
    else  
      print( "That address is in " + result.number.getValue());
  }
 }
 
catch( e )
{
  print( e.toString() );

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.