Question

Photo of Ben Wiley

0

How do I get the current person or user within a workflow?

I have Rock and another system that I am trying to sync people data between using each's own REST endpoints.  In Rock, I have a custom workflow that is triggered on person pre-save.  The workflow is sending data to the other system's API.  I don't want this workflow triggered if the save event was triggered by the API because it is redundant.  Is there anyway to tell where the trigger event occured, what user caused it, etc?

One idea: I could use post-save trigger and then check the modifiedByPersonAlias on the entity, but from what I understand that post event trigger could take 10 minutes before it runs.  Is there an immediate post save?

  • Photo of David Turner

    0

    The post save trigger is run as a queued transaction, but the transaction queue in Rock is emptied (processed) every 60 seconds, so it should only take a minute or two to run.

    Another option might be to put a special value into the person's SystemNote value when adding through the REST api. Your workflow could then check that value and only process when that value had the special note. You'll probably need to wait for v3.0 which updates the SetAttributeFromEntity action to allow setting an attribute using lava. For example if you had a 'Continue' attribute, you could set it with a value like

    {% if Entity.SystemNote == 'Added by REST' %}True{% else %}False{% end if %}

    And then use that attribute as an action filter.