I am trying to achieve the following functionality.
- New lead gets added from the web form and gets assigned to the admin
- If any other lead with the same email address already exists then reassign it to user x.
Is there any way I can do this with the Workflow? (I have managed to do the first part but struggling to do the 2nd part). If it is achievable using Logic Hooks can someone please help with the logic?
I don’t think its easy to be created on Workflow (I might be wrong on that one)
Now, with logichooks I see at least two ways to do it.
Using a before_save logic hook You try to load a bean using the name current bean’s name. If the system returns at least one, then you will now wich one it is and from there you can load the reationships
The other way (and maybe more reliable) is to query directly into the DB to get all records with the same name. From there you will be able to recover the relationship and add it to the current record.
Check this sample were I use queries.
Adding autoincremental number / date / unique number to name
Hope it helps.