Create a New Lead

This code block populates a new Account in the M4S Cache. If there is an active connection to Salesforce, then it will also be populated in Salesforce, otherwise Leads should be configured for synchronization.

Lead lead = new Lead();

lead.FirstName = "Sally";
lead.LastName = "James";
lead.Email = "sally@test.com";
lead.Company = "FuseIT Ltd";

GenericMongoService service = new GenericMongoService(Lead.SFType);

SaveResult saveResult = service.Insert(lead);
string newLeadId = null;

if (saveResult.success)
{
    newLeadId = lead.Id;
    Assert.IsTrue(service.ValidEntityId(newLeadId));
}