+ Start a Discussion

Creating a Customer Portal User through API

Hi, here is my scenario...I have a Person Account and within salesforce I can simply go to the Account and select Enable Customer Portal User and create the user and all is fine.


But I want to do this through the API.  So lets say I have the Account information, Id, name, etc.


What fields would I need to create the user in code?  I can think of the following, but there must be more because when I execute it, it comes back:  INVALID_CROSS_REFERENCE_KEY - invalid cross reference id


Here is the objective-c code I am using...


        [obj setFieldValue:@"LNameTest" field:@"LastName"];
        [obj setFieldValue:@"mtest" field:@"Alias"];
        [obj setFieldValue:@"someuser@yyy.com" field:@"Email"];
        [obj setFieldValue:@"someuser@yyy.com.test5" field:@"Username"];
        [obj setFieldValue:@"00e80000001BPSDFE" field:@"ProfileId"];
        [obj setFieldValue:@"ISO-8859-1" field:@"EmailEncodingKey"];
        [obj setFieldValue:@"America/New_York" field:@"TimeZoneSidKey"];
        [obj setFieldValue:@"en_US" field:@"LocaleSidKey"];
        [obj setFieldValue:@"en_US" field:@"LanguageLocaleKey"];


Is the profile that you are referencing one with a customer portal license?