You are viewing limited content. For full access, please sign in.

Discussion

Discussion

Forms Dynamic Approval

posted two days ago

Throwing out a scenario that we are running into more and more.  Wondering if others have found a way around this or a layout that works for them.  Not that huge details are needed but an overall approach to "dynamic approval".

What I mean by this is a variable number of approvals.  In simple terms, lets say we have a form and one of the fields on it is a table with a single approval field (list of people).  Essentially the user wants to add any number of approvers.  Sometimes the form needs 2 approvals, sometimes it needs 5, etc.  They select the people needed and submit.

I am not aware of the best way to build for this.  I know we can invoke a process to each person but there isn't a way to tie it back to the original process.  There isn't really a way to know when all (any number) of approvals have been done and bring it back into the original process.  Separate processes also break up any reporting or action history.  Reassigning tasks and such and trying to track down which task belongs to the original submission is also very difficult. 

Has anyone done something like this open ended and variable approval?  Not even saying its possible with current functionality but curious if others have approached this.

Thanks,

Chris

 

1 0
replied one day ago

Here's one I created experimenting with this.  The idea being that I wanted a way to loop through an unknown number of table rows, creating a user task for each one.  Ultimately, I never implemented it, but it did work in my testing.

It takes a bit to wrap your brain around it, but it's not too complicated once you understand it.

The form itself has three parts:

  1. A table with a username field.  Username is likely something like a lookup populated dropdown.
  2. A number field outside the table (hidden on the form) with a variable like table_row_count.
  3. A text field outside the table (hidden on the form) with a variable like current_username.

 

The fields #2 and #3 are shown in this screenshot, but they will be used by Workflow, not the form, so they don't need anything populated on the form, and can be hidden.

This is what the Forms Process looks like:

This is what the Workflow looks like:

 

Here's how the process runs through an example:

  1. Form is submitted - using the example I shared above, I am submitting it with 3 users: Matthew, Jackie, and Ashley.  It'll work through these in reverse order, from Ashley, to Jackie, and finally to Matthew.
  2. First iteration of the workflow runs.
    1. Delay - waits 1 Minute - this delay exists to ensure that the other steps in the Workflow can run in-between each iteration of the Workflow.  It does mean that there will be 1 additional minute of delay in the process for each additional row in the table.
    2. Retrieve Business Process Variables - gets table>username variables from the form, along with the table_row_count variable.
    3. Conditional Sequence - this will only be triggered on the first iteration of the workflow - the condition is checking that the table_row_count token pulled in from step #2 is empty.  It'll be populated in the first instance, so it will only be true the first time.
      1. Assign Token Values - Modify Value - this is updating the table_row_count token pulled in from step #2.  The value populated in it is based on the table>username token pulled in from step #2, and running the "Value Count" function on it - this basically counts how many rows were in the table.  In this example, it's 3.
    4. Token Calculator - this takes the table_row_count token pulled in from step #2 and subtracts 1 from it.  In this example, it's now 2.
    5. Set Business Process Variables - pushes two values back into the form - filling in those two hidden fields outside the table.
      1. table_row_count will be populated by the new value from step #4 (in this example, it is 2).
        1. table_row_count=%(TokenCalculator_New Count)
      2. current_username will be populated by the value for the current row (the table_row_count token pulled in from step #2 and/or updated in step #3.1 - it is 3 in this example) of the username field in the table (the table > username fields pulled in from step #2).
        1. current_username=%(RetrieveBusinessProcessVariables_Table\username#[%(RetrieveBusinessProcessVariables_table_row_count)]#)
  3. Having complete the workflow, this example now has a table_row_count value = 2, and a current_username value = Ashley's username.
  4. The Parallel Gateway will lead in to two separate paths.
    1. User Task will assign a task, using the value in the current_username field.  In this example, that task is assigned to Ashley.
    2. The Exclusive Gateway will check the if the table_row_count value is >= 1 (which will return to the Workflow) or if the table_row_count value = 0 (which will end the path).  In this example, since table_row_count value = 2, it will return to the Workflow.
  5. First iteration of the workflow runs.
    1. Delay - waits 1 Minute - this delay exists to ensure that the other steps in the Workflow can run in-between each iteration of the Workflow.
    2. Retrieve Business Process Variables - gets the table of usernames from the form, along with the table_row_count variable.
    3. Conditional Sequence - this will only be triggered on the first iteration of the workflow - the condition is checking that the table_row_count token pulled in from step #2 is empty.
      1. Assign Token Values - Modify Value - this is updating the table_row_count token pulled in from step #2.  The value populated in it is based on the table>username token pulled in from step #2, and running the "Value Count" function on it - this basically counts how many rows were in the table.  In this example, it's 3.
    4. Token Calculator - this takes the table_row_count token pulled in from step #2 and subtracts 1 from it.  In this example, it's now 2.
    5. Set Business Process Variables - pushes two values back into the form - filling in those two hidden fields outside the table.
      1. table_row_count will be populated by the new value from step #4 (in this example, it is 2).
        1. table_row_count=%(TokenCalculator_New Count)
      2. current_username will be populated by the value for the current row (the table_row_count token pulled in from step #2 and/or updated in step #3.1 - it is 3 in this example) of the username field in the table (the table > username fields pulled in from step #2).  In this example, it will be Ashley's username.
        1. current_username=%(RetrieveBusinessProcessVariables_Table\username#[%(RetrieveBusinessProcessVariables_table_row_count)]#)
  6. Having complete the workflow, the form now has a table_row_count value = 2, and a current_username value = Ashley's username.
  7. The Parallel Gateway will lead in to two separate paths.
    1. User Task will assign a task, using the value in the current_username field.  In this example, that task is assigned to Ashley.
    2. The Exclusive Gateway will check the if the table_row_count value is >= 1 (which will return to the Workflow) or if the table_row_count value = 0 (which will end the path).  In this example, since table_row_count value = 2, it will return to the Workflow.
  8. Second iteration of the workflow runs.
    1. Delay - waits 1 Minute
    2. Retrieve Business Process Variables
    3. Conditional Sequence (no longer evaluates as true since the table_row_count was populated on the first iteration).
    4. Token Calculator - In this example, the value is now 1.
    5. Set Business Process Variables
      1. table_row_count will be 1 now in this example.
      2. current_username will be Jackie's username in this example.
  9. Having complete the workflow, the form now has a table_row_count value = 1, and a current_username value = Jackie's username.
  10. The Parallel Gateway will lead in to two separate paths.
    1. User Task will assign to Jackie in this example.
    2. The Exclusive Gateway in this example will still return to the workflow because the table_row_count value = 1.
  11. Third iteration of the workflow runs.
    1. Delay - waits 1 Minute
    2. Retrieve Business Process Variables
    3. Conditional Sequence (no longer evaluates as true since the table_row_count was populated on the first iteration).
    4. Token Calculator - In this example, the value is now 0.
    5. Set Business Process Variables
      1. table_row_count will be 1 now in this example.
      2. current_username will be Matthew's username in this example.
  12. Having complete the workflow, the form now has a table_row_count value = 0, and a current_username value = Matthew's username.
  13. The Parallel Gateway will lead in to two separate paths.
    1. User Task will assign to Matthew in this example.
    2. The Exclusive Gateway in this example will now run to the end event because the table_row_count value = 0.

 

Here's a screenshot of the process following this example, and showing the tasks assigned to the three users:



Hopefully that all makes sense.

1 0
replied one day ago

Thanks all for your responses.  We have tried some iteration of many of these but glad others have kind of run into similar issues.  Sounds like its a tricky point for anyone (including having Laserfiche handle it).  Having a magical user task that could point at a table or collection and handle the approval/denial would be great (though I know probably not reasonable).

0 0
replied one day ago

I have linked this post to feature request: Complex decision making within a user task (#69729) 

Thanks for sharing the idea.

1 0
replied one day ago

Pencil me in for someone also who would love a "for each" loop type system for task assignment in Forms without having to do the heavy lifting in workflow after each routing as it always feels super awkward. It could just loop through a table/collection variable. Extra points if it could be set to be in parallel or series assignment.

1 0
replied one day ago

I have several forms that behave like you are describing.  I work at a university and some approvals have to go through department heads, chairs, and deans, and some approvals only need a dean's approval.  When the admin completes the form they make their choices from radio button lists.  Field rules hide and show the next appropriate radio button list. The top level looks something like this...

 

As the admin selects at each level the next appropriate radio list is shown...like this

The value of each radio button is the name of the LF team it should be assigned to.  As they make their choices the list of LF teams is built from the values of the chosen radio buttons.  In this case as shown above, this list has three teams that it will route to.  At any point the current approver can send it back to the admin to make a correction to the form, which starts the routing all over again. 

I use a table that adds a new row each time the form routes.  The approver's approval is recorded on the new row of the table and the whole history is viewable to each approver.  

Because the form is linear and is passed from approver to approver, a slow approver can hold up the process.  I've found this form to be a great use-case for Reminders.  The approver get's a reminder every 24 hours to complete their part.  I consider this the squeaky wheel step.  :)

1 0
replied two days ago

I built the flexible contract management solution template that covers this use case. It might be overkill to modify for your process but if you have a good understanding of Laserfiche already you could look through how the form works with workflow to handle this case.

In general the flow is:

  1. Table of approvers.
    1. In self-hosted you can use the forms db to autopopulate users for selection
    2. In cloud, you can use an email field and pull the username from it into a separate column
  2. A field outside the table that is "Next Approver Username", and "Next Approver Index" with a default of 1
  3. Form submits with N approvers in the table, workflow populates "Next Approver Username" and "Index" increment each time it is called with that hidden field. If the index is out of bounds of the approval column it empties both values
  4. In the forms process you loop back to the approval form as long as the hidden field is not empty making sure to call the workflow before running the exclusive gateway
4 0
replied two days ago

I've done something similar and it uses workflow.  See this post - https://answers.laserfiche.com/questions/121522/Provide-form-for-multiple-approvers#174757

Hopefully it's what you're looking for

 

3 0
replied two days ago

Chris, I curious how they know who needs to approve it. In almost every case I have found there is criteria that decides who needs to perform the approvals. In those cases, I have created an approval table in SQL, so the approvers can be dynamically populated based on the criteria decided on.

In the Forms process, you would create user tasks based on the max number of approvers you want to support and then assign those tasks dynamically based on a field value that is populated from the SQL lookup. If a specific approval field doesn't have a value, then you know that it can be skipped and would add the conditional logic into the gateway. Hope this helps.

3 0
replied two days ago

Sometimes it really is just in the users process.  They determine the various approvals.  Getting hard rules from them is always up in the air since there are always exceptions.

If we ignore that, I certainly understand the SQL side of things.  In the process diagram, wouldn't you have to build a check and essentially build a branch for each up to the max amount of approvals.  So lets say you could have a max of 10 approvals.  You would have a gateway to check the row count and then 10 branches off that.  Each branch would have sequential users tasks from 1 up to 10.  In theory your process diagram would have 55 users tasks if you had 10 possible approvals?

0 0
replied two days ago

I guess it would depend on how you set it up. With what you described, yes. I have never come across the need to have approvals setup that way. I would probably need to think on that specific situation. 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.