Jump to content
Paul Alexander

Count of how many times something has looped...

Recommended Posts

I'm setting up a BPM where an email is sent asking the requester if they want their request updated (it's for sabbatical leave, the return date of which is set, but the employee doesn't always come back - so we're asking the Line Manager whether this person has returned to work or not)

What we'd like to do is send the email, then suspend the call waiting for an update. If there hasn't been a response within a week (measured by setting the 'expiry' on the suspend node) resend the email. What we need though, is to be able to set this to only go round this loop a set amount of times. 

So, what I'm looking for is a counter (possibly something set up in the integrations node to count how many times this particular node has been 'fired'?) and, once this counter reaches a particular number, to exit the loop.

Is this something that's already possible in a BPM? Or, if not, is it something that could be added please?

thanks

 

 

Share this post


Link to post
Share on other sites

@Paul Alexander you could this by storing the loop counter in a custom field... obviously having an "internal loop counter" would be best but using the custom field would be an interim workaround until the request for the counter is considered and implemented (if...)

Share this post


Link to post
Share on other sites

Hi @Victor

I'm trying to achieve something similar. In a change I want a loop when the change manager sends the request back to the owner for more info. I've arrived at the conclusion above too, but I don't know how to execute it. I want to use h_custom_30 to store a counter. Is it as simple as adding '+1'? Or do I need more syntax? Presumably something like h_custom_30 = h_custom_30 + 1?

Any help would be gratefully received?

Thanks

Share this post


Link to post
Share on other sites

Hi @chrisnutt

I couldn't get the '+1' bit to work on mine (I'm sure it's easy, but I just couldn't get it to work) so I ended up just doing adding '&[global["flowcode"]["customField40"]]1'

That then gives you:

1

11

111

I check with a decision tree at each time round and, if the field value is 111 then I exit the loop (I only want it to go round 3 times). 

 

I don't know if that helps? 

Share this post


Link to post
Share on other sites

@Paul Alexander

Yes that helps. Certainly an option. Would be interesting to find out if there is a way to achieve what we need though. @Victor, any clues?

Chris

Share this post


Link to post
Share on other sites

@chrisnutt @Paul Alexander

&[parseInt(global["flowcode"]["customField30"])+1]

I am worried that even on holiday I know these things.. :( ... One of these days I will really take a holiday... :D 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
12 hours ago, Victor said:

One of these days I will really take a holiday... :D 

Thanks @Victor

But...

Stop working! Get some rest and enjoy your holiday

Share this post


Link to post
Share on other sites

Hi @Victor

One for when you're back. I'm getting a warning with that. I've not yet tested it. Attached is the warning message.

Chris

HB_increment.png

Share this post


Link to post
Share on other sites
Just now, Victor said:

@chrisnutt where exactly are you using the variable?

In a hornbill automation node, against the h_custom_30 field

1 minute ago, Paul Alexander said:

That error is fine.......I get it with all of my javascript additions but it doesn't stop things working.

Good to hear. Will give it a whirl when I've finished all the other bits and bobs.

Chris

Share this post


Link to post
Share on other sites
1 hour ago, chrisnutt said:

In a hornbill automation node, against the h_custom_30 field

Pics or it didn't happen!

On a serious note, any screenshot of how you use it? Because when used as update content for a custom field, the BP should not report that message...

Share this post


Link to post
Share on other sites

@chrisnutt right... mkay, maybe something changed in the validation mechanism since last time I tried... anyway, as @Paul Alexander said, as long as it's a warning, it should work. The warning is about not being able to match it with an existing variable which we're not interested into... anyway, short story, give it a try, it should work :)

Share this post


Link to post
Share on other sites
2 hours ago, chrisnutt said:

Hi @Victor

One for when you're back. I'm getting a warning with that. I've not yet tested it. Attached is the warning message.

Chris

HB_increment.png

@chrisnutt

I managed to get that warning by using the wrong variable: My Get Request Details node had a Result Reference of task, so the variable was &[global["flowcoderefs"]["task"]["customField30"]] and the code in the update node became &[parseInt(global["flowcoderefs"]["task"]["customField30"])+1]

Share this post


Link to post
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...