/
Retrieving a Specific Entity by Salesforce Id
Retrieving a Specific Entity by Salesforce Id
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.
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); }