Versions Compared

Key

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

This section is applicable to Salesforce Enterprise / Unlimited Edition package.

Authenticating Against Contacts and Leads


Code Block
languagec#
/// <summary>
/// Attempts to authenticate a user against Salesforce Contacts and Leads
/// </summary>
private void LoginUser(string userName, string password)
{
    string domainContacts = "salesforce\\";
    string domainLeads = "salesforceLead\\";
           
    //Attempt to authenticate against Salesforce Contacts
    string sfUser = string.Concat(domainContacts, userName);

if(Sitecore.Security.Authentication.AuthenticationManager.Login(sfUser, password))
    {
        //User is authenticated against Salesforce Contacts
    }
    else
    {
        //Attempt to authenticate against Salesforce Leads
        sfUser = string.Concat(domainLeads, userName);

        if (Sitecore.Security.Authentication.AuthenticationManager.Login(sfUser, password))
        {
            //User is authenticated against Salesforce Leads
        }
    }
}

Next Step

Congratulations, you have finished installing this option.

...