gravityflow_step_assignees

The gravityflow_step_assignees filter allows for the assignees of a step to be filtered.

Example: Adding a role-based assignee based on a field value

    add_filter( 'gravityflow_step_assignees', 'sh_step_assignees_role_field_value', 10, 2 );
    function sh_step_assignees_role_field_value( $assignees, $step ) {
       if ( gravity_flow()->is_workflow_detail_page() && $step->get_id() == 63 ) {
            $entry = $step->get_entry();
            //Add logic to confirm the entry value actually matches to a role within your site
            $new_role = str_replace( '-', '_', $entry['10'] );
            $args = array(
                'id'  => $new_role,
                'type' => 'role',
                'key' => 'role|' . $new_role,
                'editable_fields' => array( '1000' ),
            );
            $new_assignee = new Gravity_Flow_Assignee( $args, $step );
            $assignees[] = $new_assignee;
        }
        return $assignees;
    }

Placement

This code should be placed in the functions.php file of your active theme.