Jump to content

Using variables in a human task lifespan settings


JJack

Recommended Posts

Hi,

Can you advise how I can use variables in a human task lifespan settings?

image.png.f14c5e22016ce19c4ed5deaae33c51e4.png

If I was setting as static values in a process, I would populate, say, the Due 'Days' box with 5:

image.png.b7377c20eee8cfa6932233df33a9e2fb.png

If I click the dropdown on the 'Due' box and select Due (Variable), I get:

image.png.5542939512939a747beb52f95930a751.png

If I populate that with a variable that holds, say 5, wanting it to be a number of days, my activity appears with a date a bit less than 12 years in the future. Possibly my variable doesn't hold what I think it does, (I can display it as holding 5) but what is that Due (Variable) supposed to hold?
The separate boxes for Day/Hours/Minutes have disappeared.

The documentation Human Tasks (hornbill.com) has nothing relevant that I saw.
Sorry if I'm missing something obvious.

  • Like 1
Link to comment
Share on other sites

The variable needs to be a Date/Time value.

So if you want 5 days from now, then I think you'd need to feed the result of a "Get Local Time" HB automation node into a "Utilities/Get Timestamp" Cloud automation node just before the creation of the Human Task (using the "timestampSql" output as the "Due" variable).

  • Like 1
Link to comment
Share on other sites

I think that's not quite right for duration which is what you're after. @JJack

I think this helps: ISO 8601: The global standard for date and time formats - IONOS

"The ISO 8601 standard is also known as ANSI INCITS 30-1997 (R2008) or NIST FIPS PUB 4-2 in the United States. What’s more, it’s not only used for time values but also for durations. In such cases, the start date or time is separated from the following duration by the letter “P”. A duration that begins on September 6, 2019 at 8:00 pm and lasts one month, five days, and three hours would be expressed per the ISO standard as follows: 2019-09-06T20P1M5T3H."

So your answer I think is that the variable will be "P5T" where P is for the period and T represents Days. Hmm, it might just be "5T" if the P is only required to separate from the datetime.

There was a post on this on the forum a year or two back and Steve Giller answered me but I cannot find it in the time I had free.

  • Like 1
Link to comment
Share on other sites

Hi @Steve Giller

The link you've given takes me to the 'Duration' section of the Wikipedia page.

There it says a duration can be represented by a P ( to indicate it's a duration) and a time period; it appears that, say, P5D should indicate 5 days.
(and you don’t have to include elements where value is zero, or lower level elements you don’t care about).

As what I'm trying to specify is a variable indicating 'Due' do I just need P5D ( a 'duration') or do I need to specify '5 Days from now'? eg perhaps date/time now plus  a period?

Neither P5D nor 2024-07-15T15P5D work, they both say 'The dateTime value … specified is invalid or out of range for property 'dueDate''

 Please put something in the documentation with a couple of examples to make this option usable (for me, at least).

 I may revert to spaghetti code with multiple tasks dependant on the duration I want.

 

The only value I can get to understand slightly is that 2024-07-15T19 gives me a task due date of today at 20:00; I guess one of us isn't on BST.

Sounds as if I have to get today's date & time, then add the duration I need onto that date, ie calculate the date/time at the end of my expected duration, and set a variable value to be that calculated result. I cannot find any date manipulation or calculation nodes. I don’t seem to have any Cloud automation Utilities/Get Timestamp options as CraigP suggested. @Steve Giller, am I missing something I should have access to?

If the above is correct, than the answer I was looking for is that the variable for 'Due' needs to be something that holds the date and time I want my task to be finished - thanks @CraigP - kind of what it says on the tin, except I was expecting it to be analogous to the other input format, which is a number of days/hours etc.

 Very much appreciate your responses @Berto2002 and @CraigP but spaghetti is looking quite appetising at the moment.

  • Confused 1
Link to comment
Share on other sites

  • 1 month later...

@JJack did you get this working? I now have a need for this and it's not working for me as I expect.

I am storing "P1D" in custom M and calling that on the expiry of a Human Task and getting:

Xmlmc method invocation failed for BPM invocation node 'stage-43ba3366/task-f806e4b5': <methodCallResult status="fail"> <state> <code>0203</code> <error>The dateTime value &apos;P1DT0H0M&apos; specified is invalid or out of range for property &apos;expires&apos;, at location &apos;methodCall...

image.png.d51934b9fbe3856b2301edda27227280.png

@CraigP I think your point should be valid for the "Due" option which should be expecting a date/time but I suggest the "Expires After" option ought to expect a duration to mirror the Days/Hours/Minutes above.

Request @Steve Giller some clarification here on exactly what is required in the "Expires After" since it does not accept duration in ISO 8601 format "P1D".

Thanks in advance.

Link to comment
Share on other sites

Hi @Berto2002 Unfortunately not working for me yet, I stopped trying to get this approach to work. As above I got 2024-07-15T19 to show me a date of 20:00 (rather than 19:00) on 15th July 2024 when used as a variable for the Due date.

@Steve Giller
 I too would be interested in how the 'Expires After (Variable)' value can be specified - can you help?

Link to comment
Share on other sites

I hope there's enough noise on this one that HB look into how it works (expires after). Else we'll need to start raising support tickets since I have a need I cannot move forward with until can get a enter-entered variable of (integer) number of days passed through as an "expire after" value. Use case is project managers setting their own update interval on service transition tracking requests.

Link to comment
Share on other sites

Sorry if I'm misunderstanding the requirements, but my post applies for "Expires After" too. I can understand expecting it to take a variable that matches the day/hour/minute format (I agree that ISO 8601 formatting should be an option), but the point is you can definitely do it with a date/time variable, so that is an option if you haven't got anything else to work.

If you want to use a value from a task/outcome capture field, it could be a literal date/time (e.g. "What date/time do you want the such and such task to expire?") fed straight into the "Expires After" as a variable, or integer (via regex) ("In how many days does such and such task need to expire") fed into a "Utilities/Get Timestamp" node, the outcome of which is your date/time variable for "Expires After".

On 15/07/2024 at 17:10, JJack said:

I cannot find any date manipulation or calculation nodes. I don’t seem to have any Cloud automation Utilities/Get Timestamp options as CraigP suggested. @Steve Giller, am I missing something I should have access to?

When you add a node to the workflow, this is under "Cloud Automation" (appears as a yellow box in the workflow, not the blue "Hornbill automation"). I'm aware there are some premium iBridge connectors here, but I would have assumed the standard utilities stuff is available to everyone. Sorry if I'm mistaken, I'm not super knowledgeable on different Hornbill subscription plans.

  • Like 1
Link to comment
Share on other sites

@CraigP I think the crux of this is that the UI is telling us in black and white that Expires After is Days, Hours, Minutes (i.e. count forward for that duration); but your experience tells you that as soon as you select Variable for the Expires After, it requires a ISO formatted Date/Time field (i.e. count forward to that end point).

In short, the behaviour of that node in its variable setting is inconsistent with that node in it's manual setting; this is surely a defect.

image.png.4eeb4ae478ef2ac7d12bcd0b6d38102b.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...