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 

Inserting from multi-select into lead record

We have a lead form that largely has text input fields and I've been asked to add a multi-select list box to the mix.  My insert function is below.  Can I simply use a post call like below to add the multiple data items?

 

Thanks,

 

Chuck

 

 

 


    $contact = new sObject('Lead',
                           null,
                           array(
                               'salutation' => $_POST['salutation'],
                               'Title' => $_POST['title'],
                               'FirstName' => $_POST['first_name'],
                               'LastName' => $_POST['last_name'],
                                 'Company' => $_POST['company'],
                                 'email' => $_POST['email'],
                                'LeadSource' => $_POST['lead_source'],
                                'Street' => $_POST['street'],
                                'City' => $_POST['city'],
                                'State' => $_POST['state'],
                                'Phone' => $_POST['phone'],
                                'PostalCode' => $_POST['zip'],
                                'Country' => $_POST['country'],
                                'Star_P_Client__c' => $productuse,                               
                               'Industry' => $_POST['industry'],
                               'Database__c' => $_POST['00N30000000qVb2'],
                               'KeyProductRequirement__c' => $_POST['00N30000000qVbA'],
                               'description' => $_POST['description'],
                               'CorporateDesktopOSStandard__c' => $_POST['00N30000000qVb3'],
                               'ERPSystem__c' => $_POST['00N30000000qVbE'],
                               'CorporateDesktopHWStandard__c' => $_POST['00N30000000qVbJ'],
                            $researchreport
                           )                          
                          );
    $createResult = $sfdc->create($contact);
 

msimondsmsimonds

Sure you can  sir!

 

If you do something like this in the form

 

 

<select name="test[]" multiple="multiple"> <option value="one">one</option> <option value="two">two</option> <option value="three">three</option> <option value="four">four</option> <option value="five">five</option> </select>

 

 and then in PHP:

 

 

<?php $test=$_POST['test']; foreach ($test as $t)

{

echo 'You selected ',$t,'<br />';

} ?>

 

 

 

Hope that helps

 

~Mike

 

 

 

 

phpandsfdcphpandsfdc
In order to actually have Salesforce take the data from the multi-select, though, you'll need to first transform it into a semicolon-delimited list, e.g. $str = join(';', $arr);