The following is an example of creating a new Salesforce Account from C# using the Sitecore for Salesforce Data Connector (DC).
using Microsoft.VisualStudio.TestTools.UnitTesting; //Only used for the Assert in the example using FuseIT.Sitecore.SalesforceConnector.Entities; using FuseIT.Sitecore.SalesforceConnector.Services; //... [TestMethod] public void CreateAccount() { SalesforceSession salesforceSession = new SalesforceSession( new LoginDetails("username@example.com", "salesforcePassword")); AccountService accountService = new AccountService(salesforceSession); string accountNameToFind = "FuseIT"; Account matchingAccount = accountService.GetSingleByFieldEquals("Name", accountNameToFind); Assert.IsNotNull(matchingAccount); Assert.AreEqual(accountNameToFind, matchingAccount.Name); }
For Salesforce Organizations with customizations, like fields, you would use the T4 generated classes that match your org rather than those in FuseIT.Sitecore.SalesforceConnector.Entities
.
NB: These code snippets are applicable to the current 1.0.5 release.