Note: Requires EspoCRM version 5.5.6 or later.
This workflow rule will be creating leads from received emails. A lead will be created only if it doesn’t already exist.
Create a workflow rule with Email target entity and ‘After Record Created’ trigger.
Specify the following code in Conditions Formula:
!!targetEntity\attribute('fromAddress') && string\contains( string\lowerCase(to), 'email@example.com' ) && !record\exists( 'Lead', 'emailAddress', fromAddress )
This formula checks whether From address is not empty, To address string contains the address of the email account we monitor, and lead with the same address doesn’t exist in the system.
Add ‘Create Record’ action. Select Lead entity. Add fields Name = field From Name and Email = field From Address.