Menu
Welcome, Guest
Username: Password: Remember me
Support for Advanced Open Workflow, Sales, Portal for SugarCRM Community Edition

TOPIC: WorkFlow: Sending two different emails with a delay between them

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88812

  • philemery
  • philemery's Avatar
  • Offline
  • Premium Member
  • Posts: 103
  • Thank you received: 6
  • Karma: 3
I just saw this very useful tutorial on creating WorkFlows:


It really helped. One thing I want to do is to add a second email to the workflow after a few days. I've got the first email to send ok and both email templates ready, just not sure how to schedule the 2nd emai. Everything else I think I've got a handle on.

Here's what I'm trying to do:
Workflow (on save)
  1. (Check conditions: if yes:
  2. Send 1st Email (email 1 template)
  3. Add record to target list
  4. Create reminder to do thing
  5. Send 2nd Email (email 2 template)
  6. Call 1 month later
How would one schedule the 2nd email?
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88842

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 11144
  • Thank you received: 1669
  • Karma: 380
Hi Phil

sometimes the way to simplify complex workflows is to add custom fields to keep track of the state of each record throughout the process.

So, suppose you add two custom fields (one would be enough, but this makes things clearer, I believe): "processed" and "dateToSend"

So when you run the first workflow, for the first email, you set "processed" to false, and you set "dateToSend" to have the date when you want the second email to go out. This can be done with a Calculated field setting the date to "now plus a few days".

Then you have a separate workflow that runs "on scheduler", tests if the dateToSend has passed AND processed is false. It sends the second email and sets "processed" to true.

I hope this is understandable and helps.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88871

  • philemery
  • philemery's Avatar
  • Offline
  • Premium Member
  • Posts: 103
  • Thank you received: 6
  • Karma: 3
Sounds good - where does one add these fields? To the leads panel?
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88872

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 11144
  • Thank you received: 1669
  • Karma: 380
You add them in

Admin / Studio / (module) / Fields

You don't need to add them to any views, unless you want to show it to the users, or to let users edit them directly.

If you only plan to use the new fields in the Workflow, they don't have to be in any view, they just need to be created as custom fields.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88876

  • philemery
  • philemery's Avatar
  • Offline
  • Premium Member
  • Posts: 103
  • Thank you received: 6
  • Karma: 3
Is the "processed" field a checkbox?
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88886

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 11144
  • Thank you received: 1669
  • Karma: 380
It could be, yes. Or it could be a simple one character string where you put a "0" or a "1".

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88918

  • philemery
  • philemery's Avatar
  • Offline
  • Premium Member
  • Posts: 103
  • Thank you received: 6
  • Karma: 3
For the 2nd Worklow, the conditions would be:

Module Field Operator Type Value

Leads -> "Processed" -> EqualTo -> Value -> "0"

Leads -> DateCreated -> EqualTo -> Date-> Now -> "+" -> 3 Days

Would that work?
Last Edit: 1 month 2 weeks ago by philemery.
The administrator has disabled public write access.

WorkFlow: Sending two different emails with a delay between them 1 month 2 weeks ago #88937

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 11144
  • Thank you received: 1669
  • Karma: 380
I am not sure, I always do Workflows by trial and error.

For Date comparisons I recommend to avoid using "equal", use a "lesser" or "greater" comparison to make sure it works even if for some edge cases, like if the the scheduler skips a day, or if people edit dates manually. That's why use the second field ("processed") to make it more robust and ensure it only runs once. Date comparison sometimes are tricky.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
Time to create page: 0.062 seconds
Powered by Kunena Forum