braunyar

Micro Focus Frequent Contributor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-10-02
22:23
519 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?
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?
2 Replies
Anonymous_User

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-10-03
07:13
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
>
> 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
braunyar

Micro Focus Frequent Contributor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2018-10-05
19:16
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.