Absent Member.. Dhia-M Absent Member..
Absent Member..
352 views

Documentation for scriptlet Javascript variable/Object/method

Hi,

We are working on developing some flows and we are using javascript to handle some tasks.
However i do not find anywhere a documentation for the javascript object and method that HP OO implement. we can make some guess from the template, but in production environment we need to make sure of what each function is supposed to do (template is missing the return of non valid value, what happen when i put a local variable when a global variable having the same name ....) .
Also we are looking for some functions if they have already been implemented
- What are all the methods of "scriptletContext" (i can see getlocal(),putGlobal(),..)*
- how to put a variable as output field within the javascript.
- how to parse all variable name and values (do search on variable)

Regards

Labels (1)
0 Likes
2 Replies
Absent Member.. JasonCantrell Absent Member..
Absent Member..

Re: Documentation for scriptlet Javascript variable/Object/method

 

Hello Dhia,

 

 

 

After speaking with the OO group, they are not documented.  In general javascript is custom coding so it is rarely handled form OO Support except as break fix to our engine. I believe the box on the script references the java engine.

 

 

 

1 The template shows most of the defaults

 

2 That's in the template, I believe

 

3 Don’t think is possible if we understand your question correctly.

 

 

 

The sdk might be helpful and is found here:

 

 

 

1. Go to https://hpln.hp.com/group/operations-orchestration

 

2. Click the RESOURCES Tab

 

3. Expand HP Operations Orchestration 9.00

 

4. Expand HP Operations Orchestration 9.00 SDK

 

 

 

Kind Regards,

 

Jason

 

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
Absent Member.. Steve_Drummond Absent Member..
Absent Member..

Re: Documentation for scriptlet Javascript variable/Object/method

You cannot set an "result field" from a scriptlet. There are two scenarios for this as a kind of work around:

  1. As a result for a step, the value gets put into the variable from the output field before the scriptlet is run; you can access this value and modify/update it
  2. If you want to set new result fields on a scriptlet object you can set a temporary local variable (e.g., scriptletContext.put("tempMyvar", myvalue) and then add a result field which reads from that local variable (e.g., scriptletContext.getLocal("tempMyVar")

 

As for iterating all variables in the flow context, you cannot get a list. However, iterating a list of known names or potential known names is quite easy.

var myVars = ["var1", "var2", "var3"]
var indexVars = "indexPrefix"

for(var i = 0; i < myVars.length; i++) {
  var value = scriptletContext.get(myVars[i]);
  var otherValue = scriptletContext.getLocal(indexVars + i);
}

 

 

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.