creating a self service user
Hi there
Any idea why this code doesn't actually make a self service user?
I have a lot more than 50 users to add and wanted to do it programmatically....but no joy!!
thanks
tammy
$query="select Id,email,firstname,lastname,username__c,password__ c from Contact where contacts_id__c='20856'";
$response=$conn->query($query);
foreach ($response->records as $result)
{
$id=$result->Id;
echo "id is ".$id."<br>";
$firstname=$result->fields->FirstName;
$lastname=$result->fields->LastName;
echo "name is ".$firstname." ".$lastname."<br>";
$username=$result->fields->Username__c;
$password=$result->fields->Password__c;
echo "u and p are ".$username." ".$password."<br>";
$email=$result->fields->Email;
echo "email is ".$email."<br>";
$updateFields = array(
'IsActive'=>1,
'Username'=>$username,
'FirstName'=>$firstname,
'LastName'=>$lastname,
'Email'=>$email,
'ContactId'=>$id,
'LanguageLocaleKey'=>'en_CA',
'LocaleSidKey'=>'en_CA',
'TimeZoneSidKey'=>'America/New_York'
);
$sObjectCustom = new SObject();
$sObjectCustom->type = 'SelfServiceUser';
$sObjectCustom->fields = $updateFields;
$createResponse = $conn->update(array($sObjectCustom));
}