Question

Photo of Michael Garrison

0

2 Workflow questions - age calculation and adding a note to a person

I'm working on my first workflow- one that I'd like to be triggered when a person is added to the database. (Since it doesn't look like this is possible I'm settling for when their address is saved I mistook the filter options- right now it looks like it's going to run EVERY time someone is saved- I guess I'm going to have to add a check of RecordCreated). The idea is that a pastor needs to initiate contact with them.

I'd like the workflow to be stopped and thrown out if they are not older than 18, so I've set up an Attribute called "Age" and created a "Set Attribute Value" action to set "Age" to {{ Person.Age }}

( {{ Context.Person.Age }} works in an HTML block if added to a profile page, and I'm assuming that Context isn't required here, based on some other examples).

Then the next action checks and if the "Age" attribute is less than 18, it runs "Delete Workflow". Is that the right way to do that?

 

Second, once contact is made, I'd like their "Resolution" notes to be saved as a "Note" in their person profile. But I don't see such an action available. Previously I've noticed that there is likewise no way to add such a note in "Batch Update" either- such an ability would be quite helpful! Is there a way to do this?

Thanks

  • Michael Garrison

    October 2015: It should be noted that I've been able to verify that in v4.0 alpha, notes can be added from Workflows (Person Note Add -> communication note) and set to a value such as {{ Workflow.Resolution }}
    "Personal" notes also can be added via "Batch Update" in v4.0 alpha.
    I'll be back soon to try to figure out how to trigger this workflow, and how to throw it out if they're not 18+

  • Arran France

    I'm marking this closed as we're in 2016 now and I'm fairly certain you've got this figured out by now. If you haven't feel free to comment back and we can tackle it.

  • Michael Garrison

    We've still been using my band-aid that I mentioned with a dynamicdata block, as I haven't been able to come back and re-explore this idea. If I continue having issues with the filter I'll create a new post =)
    (Possibly though I can set a trigger on the DateRecordCreated attribute- that would only fire when a new record was actually created. Hmmm.)

  • Photo of Rock RMS

    0

    Barring the issue with the Delete workflow not working in v2.0 (fixed in v3.0) is the first part of your question working?  We'll add a feature request for the 'Add Person Note' action. Based on the roadmap and release dates that will probably be in v4.0.

    • Michael Garrison

      No, I'm apparently not understanding how to use triggers so I can't get this to run at all. For the time being I created a page with a dynamic block simply listing in chronological order everyone added to the database since we went live and we are manually creating follow up tasks from that.

    • Michael Garrison

      It's really hard to tell. Something is still not working correctly, but I don't know what part. I have a trigger set to
      Entity: Person
      Type: Post-Save
      Workflow: Newly created


      And I see several hundred "Newly Created" workflows that have apparently been triggered- most recently 5:10pm on 4/27. So it's firing sometimes. But the workflow is not doing what I expect- it should be assigning me a task for every new person added to the database. The log indicates that it's skipping the conditional "delete workflow" action (at least, there's no checkmark next to it), so I thought perhaps I wasn't setting up the condition correctly. So I went in to the workflow and added a "write to log" action with {{ Person.CreatedDateTime | DateDiff:'Now','m' }} (the lava code I've assigned to a workflow attribute which the conditional action checks) and saved the workflow. Then I edited my Admin profile (added a nick name) and checked the workflow- no new entry. I changed an Extended attribute and checked again- no new entry.


      So SOMETHING is causing it to fire, but whatever it is, is obviously not the trigger I want/expected. And when it does fire, it's running through all of the steps and immediately marking the workflow as "completed" which I'm sure is due to faulty workflow programming on my part.