Highlighted
Absent Member.. Absent Member..
Absent Member..
219 views

OMi EPi Groovy Script Seems To Not Work

Jump to solution

I have a situation where I am trying to create some custom EPi scripts.  I have them configured in the "Before Ci/ETi Resolution" under Event Automation.  Below is the code for one and it does not seem to be working.  The code appears to be correct but nothing happens.  The title is not changed and the description is not updated.

 

We are running v9.24.091 Build 111 of BSM.

 

Version Information:   HP Business Service Management 9.24.091, Build 111  

 

=============================================================================================

import java.util.List;
import com.hp.opr.api.scripting.Event;

class GroovyScriptSkeleton
{
  def init()
  {
  }

  def destroy()
  {
  }

  def process(List<Event> events)
  {
    events.each
    {
        event->modifyEvent(event)
    }
  }

  def modifyEvent(Event event)
  {
    //get event title
    String strTitle = event.getTitle()
        
    //pull node name from title
    //first get position of space
    int nPos = strTitle.indexOf(' ');
        
    //now that we know where the space is the node name is everything to that point
    String strNode = strTitle.substring(0, nPos);
    event.setNode(strNode);

    //now reset the title to strip the node from the beginning
    strNewTitle = strTitle.substring(nPos);
    event.setTitle(strNewTitle);
    
    //add comment that node was set
    event.setDescription("extracted node: " + strNode + " from title")
  }
}

==================================================================================

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.. Absent Member..
Absent Member..

I found the problem.  The logs on the DP server helped.  I am trying to set the node attribute using "setNode" but this is not a valid method.  I am trying, now, to find the correct method for setting the node attribute.

View solution in original post

0 Likes
2 Replies
Highlighted
Absent Member.. Absent Member..
Absent Member..

Hello Edward

 

please check what the log says:  \log\opr-scripting-host\opr-scripting-host.log

 

by the way, i guess you must through this document? Page 258, 269 and so on ...

 

Regards

 

Mike

HP Support
"If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.”
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

I found the problem.  The logs on the DP server helped.  I am trying to set the node attribute using "setNode" but this is not a valid method.  I am trying, now, to find the correct method for setting the node attribute.

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.