Restart a Process after it is Closed?

This may seem a little odd... 

I have a number of processes that need to be restarted when the logic in the workflow results in the process ending.

Does anyone know of a way this could be set up in Process Manager?  I'm sure this could be done with some simple internal coding, but we're in the On-Demand environment and we don't have or want any custom coding!  

I'm currently sending a message sent that says "Restart the Process" with a link to the record.  A simple "Edit/Save" without making any change will start it again.

  • Hi Bud Hartley,

    Automations in Sugar all trigger each other by design. For this reason, making loops on accident is definitely a risk.

    What you are describing here is intentionally making a loop, having one process trigger another process that then re-triggers the first process.

    Process author allows for looping within the process itself. I recommend putting a loop within the process instead of making a loop with multiple automations. Still, what you ask can certainly be done.

    Consider the following example of two processes that are designed to re-trigger Process 1:

    Process 1

    Start Event: Fires for All Updates and criteria: <your original criteria> AND "triggerProcessOne_c" equals "Yes".

    Events and other Elements that do what you want.

    Action to Update Fields: Set "triggerProcessOne_c" = "No" AND "triggerProcessTwo_c" = "Yes"

    End Event

     

    Process 2

    Start Event: Fires for All Updates and criteria: "triggerProcessTwo_c" equals "Yes".

    Wait Event*

    Action to Update Fields: Set "triggerProcessTwo_c" = "No" AND "triggerProcessOne_c" = "Yes"

    End Event

    I strongly recommend the Wait Event because if you do not wait, you could create an infinite loop that will crash your instance and cause unwanted stress for the host server.

     

    In this example, when Process 2 sets "triggerProcessOne_c" = "Yes", this will trigger Process 1.

  • Thanks Patrick,

    Yes, I've made the rookie mistake of having one process make a change that triggered a second process which in turn triggered the first.  :-)  That isn't the issue I'm trying to address.

    I have a process that waits for a date to be within 14 days of today.  The date changes often before the trigger point is reached.  With the "old" Workflow handled the dates changing since it was a single step action.

    I've coded the replacement process by using a business rule in a loop (since the rule is applied each time it loops).  When the date triggers, the process performs actions and moves on to the next step.  The next step also has a business rule that loops watching the same date field.  That step is also able to adjust to date changes and when it's triggered it moves to the final steps.

    The issue I'm trying to address is that sometimes the date change while in the second loop is such that the process needs to be terminated and started again for that record.  To handle this, I have coded the process to terminate and send a notice to me that the process needs to be restarted.  I open the record, do an edit/save and the process starts anew for that record.

    Without making an internal coding change, I'd like to have the process terminate then restart the same process for that record...  If this isn't possible, I'll live with the notice and manually restarting the process.  There are at most 10 of these a week, sometimes as few as two.

    I debated about making a clone of the process and adding a field that would trigger the clone and terminate.  The clone could have a field that would trigger the original and terminate if needed.  For lots of reasons, I don't want two processes that basically do the same thing.

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)

  • Hi Bud Hartley,

    In my original response, I was not thinking you were trying to fix accidentally looping two processes. I was telling you that you could intentionally do it to meet the goal you described wanting.

    If I am understanding what you described correctly, you have a few options to build this out for that path that currently sends you an email then terminates the process.

    1. Remove the send message and End Event, and have a flow line circle back to the first element (Is that a parallel gateway?) after your process's Start Event. In this way, the process would loop on itself.

    2. Add a criteria to your Start Event so it is like:

    Start Event: Fires for All Updates and criteria: <your original criteria> AND "triggerProcessOne_c" equals "Yes".

    Replace the Send Message with an Action like:

    Action to Update Fields: Set "triggerProcessOne_c" = "No" AND "triggerProcessTwo_c" = "Yes"

    Then, have a simple other process like:

    Process 2

    Start Event: Fires for All Updates and criteria: "triggerProcessTwo_c" equals "Yes".

    Wait Event*

    Action to Update Fields: Set "triggerProcessTwo_c" = "No" AND "triggerProcessOne_c" = "Yes"

    End Event

    I hope that helps.

  • One additional thought I had was to have the process modify a field (like "Restart the Process" = yes) and have a second process that starts when that field = "yes", waits 10 minutes, resets the field to "no" and saves the record.  That would fire the first process.  I may "play" with that idea to see if it works for me.

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)

  • SUCCESS!

    I created a simple process (start if the "Restart?" field = "yes" - Wait 10 minutes - Change the "Restart?" field to "no" - Terminate the process).

    In the original process, I added a step to change the "Restart?" field to "yes" before it was terminated.  (I'm still sending the alert to myself for now so I may monitor the activity).

    I'll test the possible "loop back to the beginning" this week to see if it works.

    Thanks again Patrick!

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)