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

Discussion

Discussion

Best practices for complex Forms routing?

posted on November 2, 2020

We are about to start building a process that has dozens of checkboxes across multiple fields, and we need to route to certain users depending on which boxes are checked.

For example:

Checkbox A: checked - Route to user X

Checkbox B: unchecked - 

Checkbox C: checked - Route to users X, Y

Checkbox D: checked: Route to user Z

In this example, we'd need to route to users X, Y, and Z in a predefined order. There are only about 4 users, but 70 checkboxes.

My initial thought is to use onChange listeners on the checkbox fields, have JavaScript look for which boxes are checked, and fill in some hidden fields that we can look into in the process. For example, when Checkbox A is checked, the hidden field 'routeToUserX' will be marked as 'Yes' then we can check that condition in the process.

That approach seems difficult to maintain, though, and I'm not sure if there's an easier way to do it. Has anyone solved a similar problem in a better way?

0 0
replied on November 4, 2020

Hi Brian

I tend to do this in two steps with a couple hidden fields to build what I call Routing Values to use in my BP

If you CONCATENATE or JOIN the checkbox values into a field You will end up with a RESULT such as TRUEFALSETRUETRUE  (means A,C, and D were selected, B was not.

Then you can use this resulting field with an IF statement to determine a Routing Value such as,
=IF(VAR1="TRUEFALSETRUETRUE","RTOption1","RouteOption2")

You would end up nesting this to account for the different ROUTING Options

Then in your BP you would use this Result in the Conditions to determine Path flow.

By doing it this way I can easily see, test and change the Formulas to account for differing conditions without having to change the BP and without using JS

1 0
replied on November 3, 2020

Hello Brian,

 

I have looked into your scenario and checked some customizations you can do in forms, and i could not get to a simple solution, but i am thinking if you can take advantage of the workflow to compute your end result for the routing and send it back to forms.

I think it can provide some simplicity and clearness.

 

Maher.

1 0
replied on November 3, 2020

Thanks Maher, I think it will just be a lot of conditions checking in JavaScript. Will just need a good amount of coffee to get through it

 

$( '.check-for-routes input' ).change(function() {
    let routeToUserX = false;
    let routeToUserY = false;
    let routeToUserZ = false;

    if ( $('#Field-12\(0\)').is(':checked') ) { // doc type: maintenance request
        routeToUserX = true;
        routeToUserY = true;
    }
    if ( $('#Field-12\(1\)').is(':checked') ) { // doc type: finance request
        routeToUserZ = true;
    }
    if ( $('#Field-12\(2\)').is(':checked') ) { // doc type: HR Request
        // placeholder: do nothing.
    }
    //.......
    //.......
    //.......
    $( '#Field45' ).val( routeToUserX ? 'Yes' : 'No' )
    $( '#Field46' ).val( routeToUserY ? 'Yes' : 'No' )
    $( '#Field47' ).val( routeToUserZ ? 'Yes' : 'No' )
})

 

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

Sign in to reply to this post.