Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This code block retrieves multipls Lead records from the M4S cache. If no records are found and M4S is configured to read from Salesforce, then Salesforce will be searched.

Code Block
languagec#
GenericMongoService service = new GenericMongoService(Lead.SFType);

List<EntityBase> matchingLeads = service.GetByFieldEquals(Lead.Fields.Company.Name, "FuseIT Ltd");

foreach (EntityBase matchingLead in matchingLeads)
{
    if (!string.IsNullOrEmpty(matchingLead.Id))
    {
        Lead lead = new Lead(matchingLead);
    }
    else
    {
        //Lead has been created in the cache but is not yet synchronized.
        Lead lead = new Lead();
        lead.Any = matchingLead.Any;
    }
}