outbound javascript only to update record in other tool from HPSM

Hi Team,

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

 

Regards,

Zafar

  • Verified Answer

    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() );