function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chuckdubdubchuckdubdub 

Updating custom lead field w/nusoap & API

Hi there,
 
I'm using modified nusoap.php for PHP4.  Anyway, I'm trying to figure out the syntax to update a custom lead field.
 
I can find the unique identifier for the field in SF, but I get no joy when I added it to my update array. 
 
Am I waaaay off??
 
    // update Lead record
    $contact1 = new sObject('lead',
            $id,
            array(
                'Description' => 'My test',
         // this is the custom field right below here which equates to a checkbox in the SF interface.
       // I want it checked...  I've tried 1 and '1' but no dice:
      
         '00N300000016PAX' => 'TRUE',
 
   'Email' => 'cwyatt123@blahblah.com'
            ),                          
                array('Phone', 'Fax')
           );
    $updateResult = $sfdc->update($contact1);
    print_r("\nupdate one: \n\n");
    print_r($updateResult);
Thanks,
 
Chuck

Message Edited by chuckdubdub on 05-17-2006 03:47 AM

Message Edited by chuckdubdub on 05-17-2006 03:48 AM

Park Walker (TAGL)Park Walker (TAGL)
Your on the right track, but you need to use the name of the field, not it's ID... and don't forget the __c at the end. You can get the name by examining the field in field maintenance; it's not the same as the title.

Park
chuckdubdubchuckdubdub
OK, thanks Park!
 
So it is like this:  I'm in App Setup -> Leads -> Fields and I'm looking at the field name, which is "white_paper" and it is a "checkbox," so I'm trying something like this now (still no cigar just yet):
 
    $contact1 = new sObject('lead',
            $id,
            array(
                'Description' => 'My test',
                'white_paper_c' => 'TRUE',
    'Email' => 'cwyatt123@blah.com'
            ),                          
                array('Phone', 'Fax')
           );
    $updateResult = $sfdc->update($contact1);
 
Muchas gracias!
SuperfellSuperfell
Whats in $updateResult ? do you have the double underscore in the __C part ?
chuckdubdubchuckdubdub
Oh...OK!  That double-underscore fix did it.  :smileyhappy:  That's great.  So now when I try and update my checkbox field I'm getting "value not of required type."  Though I'm trying 1 with/without quotes, 'TRUE', 'CHECKED,' 'YES.'   Hmmm.
 
$updateResult shows me this array:
 
 Array ( [errors] => Array ( [fields] => [message] => white paper: value not of required type: YES [statusCode] => INVALID_TYPE_ON_FIELD_IN_RECORD ) [id] => [success] => false )
 
Thanks -- this is a great help!
 
-Chuck
SuperfellSuperfell
That means your soap toolkit is sending over the xml type of the element, and it doesn't match what we're expecting it to be (an xsd:boolean), it's likely that php is claiming its a string. I'm not sure how you go about changing that, hopefully one of the PHP folks can answer that.
chuckdubdubchuckdubdub
Found it:
 
 $whitepaperval = new soapval('white_paper__c', 'boolean', 'TRUE');
 
    $contact1 = new sObject('lead',
            $id,
            array(
                'Description' => 'My test',
                 'Email' => 'cwyatt123@blablah.com,
      $whitepaperval
            ),                          
                array('Phone', 'Fax')
           );