Micro Focus Contributor
Micro Focus Contributor
450 views

Approval Activity Timeout scripting

Hi I ma trying to pass a timeout value for an approval activity. So the timeout can be set using a GCV. but no matter what I try to use in the ecma for the timeout it fails to work.

This is what I tried recently to get the number.

Number(flowdata.get('workflow/delayHours'))

or

Number(flowdata.get('workflow/delayHours')).valueOf()

both of which set a timeout but it was set to 0 instead of the value in the flowdata. which is being set to 48 on the initial start activity.
if I just enter 48 in the timeout field it works but i cant find any way to return a number and get it to work. what am I missing?
Labels (1)
0 Likes
2 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Approval Activity Timeout scripting

On 10/2/2018 3:24 PM, braunyar wrote:
>
> Hi I ma trying to pass a timeout value for an approval activity. So the
> timeout can be set using a GCV. but no matter what I try to use in the
> ecma for the timeout it fails to work.
>
> This is what I tried recently to get the number.
>
> Number(flowdata.get('workflow/delayHours'))
>
> or
>
> Number(flowdata.get('workflow/delayHours')).valueOf()
>
> both of which set a timeout but it was set to 0 instead of the value in
> the flowdata. which is being set to 48 on the initial start activity.
> if I just enter 48 in the timeout field it works but i cant find any way
> to return a number and get it to work. what am I missing?
>
>


There is an issue where whenever the timeout was calculated from flowdata
its unit becomes milliseconds instead of whichever unit you've selected.

Happens in 4.0.x, 4.5.x and 4.6.x from my experience, so if you
want hours do:

Number(flowdata.get('workflow/delayHours')) * 60 * 60 * 1000

(your hours times 60 minutes times 60 seconds times
1000 for milliseconds)

Cheers,

-Fernando
0 Likes
Micro Focus Contributor
Micro Focus Contributor

Re: Approval Activity Timeout scripting

Fernando Freitas;2488344 wrote:
On 10/2/2018 3:24 PM, braunyar wrote:
>
> Hi I ma trying to pass a timeout value for an approval activity. So the
> timeout can be set using a GCV. but no matter what I try to use in the
> ecma for the timeout it fails to work.
>
> This is what I tried recently to get the number.
>
> Number(flowdata.get('workflow/delayHours'))
>
> or
>
> Number(flowdata.get('workflow/delayHours')).valueOf()
>
> both of which set a timeout but it was set to 0 instead of the value in
> the flowdata. which is being set to 48 on the initial start activity.
> if I just enter 48 in the timeout field it works but i cant find any way
> to return a number and get it to work. what am I missing?
>
>


There is an issue where whenever the timeout was calculated from flowdata
its unit becomes milliseconds instead of whichever unit you've selected.

Happens in 4.0.x, 4.5.x and 4.6.x from my experience, so if you
want hours do:

Number(flowdata.get('workflow/delayHours')) * 60 * 60 * 1000

(your hours times 60 minutes times 60 seconds times
1000 for milliseconds)

Cheers,

-Fernando


Fernando that worked Perfectly.

But I don't think this needs to be marked as a defect it just needs to be better documented.

Because this allows me not only to control how many time units but also which time units.
So I created another GCV for time units of iteration with it listed as minutes days hours etc..
And then in dev the timeout can be set to minutes or hours rather than the days you would see in production.

This defect gives a very granular control over the workflows that the documentation implies is not possible.
Number(flowdata.get('workflow/delay')) * Number(flowdata.get('workflow/delayUnits')) * 1000

Just a suggestion.
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.