shaun0024 Absent Member.
Absent Member.
1840 views

Scriplets in HP OO

Jump to solution

Hi everyone,

I am new to HP OO and have been trying to get some information on how scriplets work. The included guide does not appear to be very comprehensive in this regard and there doesn't seem to be much online either. Are there any other material available on this? I'm basically trying to do some very simple stuff like taking the result from an operation and manipulating it (mathematical operators and string manipulation like string replacement) before handing it over to the next step in the flow.

Thanks in advance.

 

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Scriplets in HP OO

Jump to solution

Hi,

In order to manipulate the result of an operation via scriptlet the scriptlet has to be used as a filter on the result instead of the scriptlet tab on the step. The scriptlet tab gets resolved prior to the step itself, therefore in the scriptlet tab you can only use inputs of the step not results. 

In the filter the result as it curently exists when resolving the scriptlet can be accesed with the keyword "scriptletInput". Do note that by default the scriptlet will treat all values as strings, therfore in the case where you want to do math operations on a result your scriptlet might look something like this:

scriptletInput = parseInt(scriptletInput) + 15;

Once you are satisfied with the processing of the result to use the processed value assign that value to the "scriptletResult" keyword, for example:

scriptletResult = myProcessedData;

Hope this helps, in case you have specific uncertainties regarding scriptlets let us know and we will be better able to help you.

Regards,

Vlad

 

0 Likes
8 Replies
Micro Focus Expert
Micro Focus Expert

Re: Scriplets in HP OO

Jump to solution

Hi,

In order to manipulate the result of an operation via scriptlet the scriptlet has to be used as a filter on the result instead of the scriptlet tab on the step. The scriptlet tab gets resolved prior to the step itself, therefore in the scriptlet tab you can only use inputs of the step not results. 

In the filter the result as it curently exists when resolving the scriptlet can be accesed with the keyword "scriptletInput". Do note that by default the scriptlet will treat all values as strings, therfore in the case where you want to do math operations on a result your scriptlet might look something like this:

scriptletInput = parseInt(scriptletInput) + 15;

Once you are satisfied with the processing of the result to use the processed value assign that value to the "scriptletResult" keyword, for example:

scriptletResult = myProcessedData;

Hope this helps, in case you have specific uncertainties regarding scriptlets let us know and we will be better able to help you.

Regards,

Vlad

 

0 Likes
shaun0024 Absent Member.
Absent Member.

Re: Scriplets in HP OO

Jump to solution

Hey Vlad,

Thank you very much for your reply in elaborating how scriplets work. I think I understand better now and will give it a shot.

Are there any limitations to the Javascript implementation within HP OO?

Will certainly look for your knowledge again should I encounter any issues. 

Thanks again.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Scriplets in HP OO

Jump to solution

Hi, 

As far as i know there are no specific limitations on the scriptlet. Make sure that what you are attempting to do is supported by the javascript type. In the latest version of OO we support both rhino and nashorn. 

Nashorn scripts are supported starting with OO 10.50, therefore if you know that your content may end up in OO versions prior to 10.50 make sure to use only rhino scriptlets.

Regards,

Vlad

0 Likes
AndreiTruta Outstanding Contributor.
Outstanding Contributor.

Re: Scriplets in HP OO

Jump to solution

@shaun0024 this old document can provide further assistence. we talked here about scriptlets too.

https://lnast01pcache.saas.hpe.com/asset/resources/pd/oo/21q1459952042/HPOO_UnderstandingExecutionOrderAndMore_Guide.pdf 

Andrei Vasile Truta
0 Likes
shaun0024 Absent Member.
Absent Member.

Re: Scriplets in HP OO

Jump to solution

Thanks Vlad! Appreciate your assistance.

0 Likes
shaun0024 Absent Member.
Absent Member.

Re: Scriplets in HP OO

Jump to solution

Hi Andrei,

Thanks for the advise and link. However, the link seems to be dead though.

0 Likes
AndreiTruta Outstanding Contributor.
Outstanding Contributor.

Re: Scriplets in HP OO

Jump to solution

I am not sure why you are facing that link problem.

Try to get here and look for the very last item in the list: Introduction to flow execution and flow authoring

https://hpln.hpe.com/product/operations-orchestration/resources/tutorials 

Anytime,

Andrei Vasile Truta
0 Likes
shaun0024 Absent Member.
Absent Member.

Re: Scriplets in HP OO

Jump to solution

Thanks Andrei.

I'll have a look at the link. Appreciate your assistance.

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.