Question

Photo of Cory Forsythe

0

Invoke new workflow for each groupmember in a group

Is it possible to fork a workflow (executed upon a group entity) so that new workflows of the same type can be invoked for each member of a group?  I would like to trigger workflows upon group post-saves and then inspect each member for applicable sub-flows that would apply to each member person record.



  • Photo of Michael Garrison

    0

    If you are wanting to fire a workflow whenever a person is added or removed, you can configure such workflows on the group itself. This will provide the new workflow with a GroupMember object, so you can capture the group and person involved using the Set Attribute From Entity action, using {{ Entity.Group.Guid }} to store the group in a Group type attribute, and {{ Entity.Person.PrimaryAlias.Guid }} to store the person in a Person type attribute.

    If you are wanting to periodically have a workflow run over an entire group, you might be looking at a more complex workflow with multiple instances of a specific activity, such as is documented at http://shouldertheboulder.com/Article?id=861

    The last option that comes to mind is this: you could also have a "master" workflow that loops through all members and triggers a different workflow type for each member using the Activate Workflow action (see https://www.rockrms.com/WorkflowActionCategory?Category=2 )

  • Photo of Michael Garrison

    0

    I should have added also, that using v7 and later, you could also use an EntityCommand in an HTML block (for instance). That might look something like

    {% groupmember where:'GroupId == "123"' %}
    {% for gm in groupmemberItems %}
        {% workflowactivate WorkflowType:42 Person:gm.Person.PrimaryAlias.Guid Group:gm.Group.Guid %}{% endworkflowactivate %}
    {% endfor %}
    

    This would activate Workflow Type 42 for every member of Group Id 123, and within the workflow you'd be able to capture the person and group in question simply by having attributes with keys Person and Group