We are starting a project that will enable us to sell services to individuals over the force.com platform but from within a application that is in-house. I am writing the specification for the internal programmers but I am puzzled over something that I know as a SFDC admin: community users are created from contacts.

If my programmers are creating a new community user over (restful, I think) APIs what is the process? I know that the API call to use is create() and the first argument is the sObject to create as below (taken from another thread on salesforce.stackexchange

var client = new SalesforceClient();
var authenticationFlow = new UsernamePasswordAuthenticationFlow
(clientId, clientSecret, username, password);

client.Authenticate (authenticationFlow);

var user = new 
    Username = "email@domain.com",
    Alias =  "userAlias",
    // The ID of the user profile (Standard User, System Administrator, etc).
    ProfileId = "00ei000000143vq", 
    Email = "email@domain.com",
    EmailEncodingKey = "ISO-8859-1",
    LastName = "lastname",
    LanguageLocaleKey = "pt_BR",
    LocaleSidKey = "pt_BR",
    TimeZoneSidKey = "America/Sao_Paulo"

var id = client.Create ("User", user);

My question: If we create a contact and then create a user, what is it that we have to do to tie the users to the contacts (or vice versa)?

Is this a red herring? Should I be concentrating on this?

  • 1
    I guess you are talking about Customer Community Users right ? Because if you need to create Partner Community Users you also need an Account. For customer community users the answer of @geekymartian is correct ! – ManSpan Nov 19 '14 at 16:12

User object has a ContactId field that ties it to the Contact record.

user.ContactId = yourcontactId;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.