findOne — finds a record on a specific entity by searching with field value.


Minimum number of  arguments for this method is three. The first argument is the entity name and the other two are Field Alias – Field Values pair that will filter the result. The Field Alias can be a unique identifier field and the Field Value is its value.

This method says “Find lead with email equal to” where lead is the entity, email is the field alias followed by the value. This method will return one record that matches the defined filters.

Structure of the method:

findOne('Entity Name', 'Field Alias', 'Field Value')


The first argument is always Entity Name like for example “lead” or “contact”. You can add as many pair arguments as you want.

#Sample 1

{% set lead = findOne('lead','email', '')


//Output: the id of the record


//Output: John



#Sample 2 with pair field alias, field value

{% set lead = findOne('lead','status', 'New', 'source', 'Pending') 
Id: {{}} 
Name: {{lead.first_name}} 
Email: {{}} 

//Output: Will output the id, first_name, email of the first record found.

To stay updated with the latest features, news and how-to articles and videos, please join our group on Facebook, Flexie CRM Academy.