+ Reply to Thread
Results 1 to 2 of 2
This is a discussion on creating a self service user within the Salesforce Coding Discussions forums, part of the Salesforce category; Hi there Any idea why this code doesn't actually make a self
  1. #1
    sager@cmc.ca is offline Junior Member
    Join Date
    Jan 2010
    Posts
    11

    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));



    }

  2. #2
    Adam Best is offline Junior Member
    Join Date
    Apr 2011
    Posts
    10
    Hi Tammy,

    Here are my fields that successfully worked.

    $formData[LastName]=$user->LastName;
    $formData[FirstName]=$user->FirstName ;
    $formData[Name]="$user->FirstName $user->LastName";
    $formData[Username]=$user->Email;
    $formData[Email]=$user->Email;
    $formData[IsActive]='true';
    $formData[ContactId]=$user->Id;
    $formData[TimeZoneSidKey]='Pacific/Pago_Pago';
    $formData[LocaleSidKey]='en_AU';
    $formData[LanguageLocaleKey]='en_US';

    With the object:

    $objectData[objType]='SelfServiceUser';

    Try active = "true"

    Apart from that your fields and values look good.

    Please post your response "print_r($response)" here so i can see the error messgae
    Thx
    Adam.
    Regards,
    Adam

    Into Joomla! and SalesForce?
    Check us out below at
    http://www.miiworks.com/

+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 01-21-2011, 08:18 PM
  2. how to receive user data from salesforce to php
    By lucasvm in forum Salesforce Coding Discussions
    Replies: 1
    Last Post: 01-15-2009, 09:27 PM
  3. Dynamic REST Web Service
    By barrylast in forum Salesforce Coding Discussions
    Replies: 3
    Last Post: 11-30-2008, 03:08 PM
  4. Replies: 0
    Last Post: 05-24-2008, 05:43 PM
  5. Create User On Salesforce with PHP
    By mike in forum Salesforce Coding Discussions
    Replies: 0
    Last Post: 09-21-2007, 09:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2