Versions Compared

Key

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

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

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

EntityBase matchingLead = service.GetSingleByFieldEquals(Lead.Fields.LastName.Name, "Smith");

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;
}