Action to have condition in it to trigger itself

We are using suitecrm for multisite newtwork

we have created one custom action which is supposed to send mail to manager on new lead.

we have approx 3 sites and from all 3 we are collecting leads.
Now we want that for 1st site , we need to send mail1,
for 2nd site , we need to send mail 2,
for 3rd site , we need to senf mail 3.

Note that we are storing site id in one of the field of lead.

so the thing is using one single workflow we are tring to send different mail to user of different site,

we are going to have apprx 10 sites more.

please let us know how to achieve it.

Thanks In advance.

I can’t try it on an actual Workflow right now, so I don’t know if my suggestions work or not, you’ll have to try them yourself.

  • maybe you can get a calculated field to form the email address, from the site_ id field.

  • in a totally different approach, you can have a second custom field already prepared, holding the correct email address. This field would be prepared when importing data, or in a previous workflow, that whenever you change the site_id field, it changes the email address using calculated field.

  • In the above, I am assuming your email addresses can be formed from the site_id, for example, site 3 gives email someaddress3@domain.com. If not, then you’re probably better off just discarding Workflows altogether, and go for a Logic Hook where suddenly these complicated logics become very simple :slight_smile:

Thanks for your quick reply,

It looks like there is some misunderstanding .

“we need to send mail1,” means we need to send content of mail1 when lead comes via site 1
we need to send mail2 means we need to send content of mail2, when lead comes via site 2 etc…

Oh, I thought you meant different email addresses.

So, how different are these emails? Completely different email templates, or do you just need some variable differences in the same template?

Are you a developer? If so, I advise to really go for the logic hook, it’s not that difficult and you get so much more control.

we are tring to send different email templates.

We are tring to develope in a way that it cam allow to easily add new site and modify existing mapped email without going in core files of suitecrm every time.

so if it is possible to use hook file to set any construct which can allow above dynamic nature then it would be good.

Sure, you can make the hook static, but make the behaviour dynamic, just use some notation.

For example, if your hook uses, for site_id3, the Email template “WelcomeLeadFromSIte3”, and so on.

When you open site 37, you don’t have to change the hook, you can just add a template called “WelcomeLeadFromSite37”.