HPSM Javascripting

Hi all,

I'm very new to HP Service Manager scripting and unable to understand the scripting through documentations.

Can someone kindly help me to implement this small requirement mentioned below:

"We have slaactive table and incidents table,we created a new key in slaactive table "assignee.name" to store the value of "assignee.name" from incidents table.

I'm not able to understand how to populate this field from incidents table.

The requirement is to fill the assignee.name in slaactive table whenever the ticket is assigned to someone.

Can someone kindly explain me stepwise on how to do this?

In the SM 9.40 version we can do the same for workflow based tables by simply using the validation rule set and usig the fill option.But unfortunately the slaactive is not process designer based.

 

Any help much appreciated.

  • Hi, Sahil

    Here is the javascript you could use, please replace the parameter "IM10002" with the variable for incident ticket id you updated. 

    UpdateTicketAssignee("IM10002")
    function UpdateTicketAssignee(IMNumber)
    {
          var probsummary_table = new SCFile("probsummary", SCFILE_READONLY);
          var slaactive_table = new SCFile("slaactive");
         
          var rCode = probsummary_table.doSelect( "number=\"" IMNumber "\"" );
          var rCode1 = slaactive_table.doSelect("foreign.key=\"" IMNumber "\" AND foreign.filename=\"probsummary\"");
       
          if (rCode == RC_SUCCESS)
          {
              slaactive_table.assignee_name = probsummary_table.assignee_name;
              var rCode2 = slaactive_table.doSave();
              print(RCtoString(rCode2));
              print(slaactive_table);
              return slaactive_table         
          }
    }

    Thanks

    Desmond