Versions Compared

Key

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

This code block retrieves a specific entity from the M4S cache. If the entity does not exist in M4S, then it is retrieved from Salesforce and cached.

Code Block
languagec#
GenericMongoService service = new GenericMongoService(Lead.SFType);
Id leadId = new Id("00Q2800000fgxkKEAQ");

EntityBase entity = service.GetByEntityId(leadId, new SObjectField[] { Lead.Fields.Id, Lead.Fields.FirstName, Lead.Fields.LastName });

if(entity != null)
{
	Contact contact = new Contact(entity);
}