Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..
134 views

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.

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

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

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.