I have a site I’m building using Gravity Flow, with a fairly complex workflow. One of the things I really need to be able to do is to make assignments in the workflow based off a list. I know you can assign individuals and user roles within Gravity Flow, but because these lists can be extensive and need to be changed frequently, I need a better way.
For this use case I have 100+ worksites and certain people/users assigned to each. However, worksites can be renamed and people get shuffled between the sites. Reassigning user roles would be a monumental task to do one by one every time this happens. I really need a place where I can list out each worksite as well as the users/groups that are assigned to them and then easily make changes to these lists as needed. I need to be able to assign these groups based on conditions in the workflow and know that when I change something in the list that the workflow conditions will continue grabbing the right group which has then been edited.
I can’t find any existing add-on or extension that seem to already do this. I thought about sending data back and forth from Airtable but I’m hoping there’s a cleaner solution that I can use inside the website itself. Has anyone else found a solution for something like this?
That sounds like a super project. I’ve included some thoughts and doc links below that should help you structure this project.
Is there a non-WordPress system that has that relationship of worksites / staff is already managed?
I’d first suggest looking whether it has an API that you could use with the Outgoing Webhook step type to retrieve “the right users” for. Mapping that into a multi-user field, possibly using the gravityflow_entry_webhook_response_mapping filter, would then let subsequent steps based their assignees on that field.
Yes, I find the default WP admin UI for users to pre-filter to a specific role, then bulk select users to then add/remove new roles to does hit it’s useful limit around 5-10 people being changed at a time. Depending on what you know about the people who are changing, the Update User Step Type which builds off the Forms User Registration add-on may make things a little better, but I suspect you would want to explore a custom step type which has its’ process() function doing a series of wp_update_user calls.
Alternatively, having the worksites and staff in them as separate forms/entries within them could make the editing UI easier to manage. I’d think a GravityView datatable would be worth exploring there.
Regardless of which route you go, for scenarios where the source data for assignees is managed/maintained outside the step settings, or field values within it, the gravityflow_step_assignees filter would be one you want to leverage to (re)determine the assignees based on your custom logic. The gravityflow_step_settings_fields filter might also combine with it so that you could define “what” the worksite/user/etc relationship is to the step within custom settings and then use the gravityflow_step_assignees to pull which ones meet those conditions.
Please let us know how you get on with building this out, it’s an interesting use case and I’m quite sure that Flow has the tools in its’ toolkit to help you address it. Hopefully the above is enough that you can tackle the code/configuration yourself. If you need more pointers, Gravity Flow support is there for you. Or if it turns out to need more dedicated dev effort, Gravity Experts would be worth reaching out to.