+ Reply to Thread
Results 1 to 4 of 4
This is a discussion on Invoicing within the Salesforce Coding Discussions forums, part of the Salesforce category; ive been assigned to integrate salesforce on our website.. we have a
  1. #1
    nhimrod is offline Junior Member
    Join Date
    Mar 2010
    Posts
    2

    Invoicing

    ive been assigned to integrate salesforce on our website.. we have a registration page and we want to save the data on salesforce everytime a client registered on our website.. is it possible? our website is running in php. is there an API from saleforce that i can use to send the information of our registered clients and salesforce would generate an invoice?

    how can i submit all the fields from our website to salesforce?

    thanks in advance.

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Sorry that I have not responded, but I am dealing with a health issue at the moment. I have a pinched nerve in my neck that has basically left my left arm unusable.

    I will do my best to help you out and may ask you some questions along the way. You can do what you are asking because you want to insert some information on a form that is filled out on your site. So here is your scenario, which is my best guess.

    1) A user is registering on your site and submitting a form that is stored in either a post array or in a get array, am I correct there?

    2) To insert those fields into an object/table in Salesforce you would do something like the following:

    3) Let's say your salesforce object is lead account object and want to create a record with your data:

    PHP Code:

    //this uses another script which has a $client array of your login to salesforce which you can user in any of
    //salesforce scripts. posted above
    require_once ('/users/msimonds/public_html/includes/sfdc.inc');   

    //create an array name that you are going to insert using as your data array
    $data_array = array();


    //these fields in the data_array must match your API names on fields such as custom fields
    $data_array['field_one'] = $_POST['field_one'];
    $data_array['field_two'] = $_POST['field_two'];
    //example of custom field
    $data_array['custom_field__c'] = $_POST['field_three'];

    //now you want to create the salesforce object to create your record in your object

    $sObject = new sObject();
    //the Sobject type is the name of the object that you are going to insert the record too
    $sObject->type 'Lead';
    // this is the $data_array  that you setup above with the fields
    $sObject->fields $project;

    //This creates the record from the $Sobject 
    $result $client->create(array($sObject));


    //do something with the result object when it comes back

    if ($result->success)
    {
       echo 
    'record created';
    }
    else
    {
       echo 
    'creation failed';

    Here is a small script that you can modify to use in any of your scripts that logs in to salesforce and gives you one central location for your username and password and makes it a whole lot easier to control your login credentials.

    make sure you change the paths to your partner client and WSDL and call this sfdc.inc. You will see this in the code above being called first

    PHP Code:
    <?php
    require_once ('/users/msimonds/public_html/includes/soapclient/SforcePartnerClient.php');
    require_once (
    '/users/msimonds/public_html/includes/soapclient/SforceHeaderOptions.php');

    // Login to salesforce.com
    $login "you@email.com";
    $password "password";
    $wsdl "/users/msimonds/public_html/includes/soapclient/partner.wsdl.xml";

    $client = new SforcePartnerClient();
    $client->createConnection($wsdl);
    try
    {
        
    $loginResult $client->login($login$password);
        if (
    $loginResult->passwordExpired)
        {
            
    $client null;
        }
    }
    catch (
    exception $e)
    {
        
    $client null;
    }
    ?>
    see if this makes any sense and will help you, it should give you an idea of what needs to be done. I will check back to see if this helps at all


    Again sorry for the delay

    ~Mike

  3. #3
    nhimrod is offline Junior Member
    Join Date
    Mar 2010
    Posts
    2
    hi mike.. sorry to hear about your injuries..

    but thanks for your time replying on our concerns this is very useful guide for us to start the integration.. however if you dont mind i still have more followup questions..

    1. where can i find or download the sfdc.inc file?

    2. whats the API names? say for example that im going to pass a 3 field form namely firstname, middlename and lastname.. should i declare it as:

    $data_array['fname'] = $_POST['firstname'];
    $data_array['mname'] = $_POST['middlename'];

    $data_array['lname'] = $_POST['lastname'];

    3. does salesforce have a manual for LEADS? particularly for adding, editing and deleting an account..

    4. on our website we call the registrant an 'account' after a sucessfull registration, does it stands for 'lead' on salesforce terminologies?

    5. will the salesforce create a database for us? if yes, how can we setup the fields?

    6. and lastly.. does salesforce require an authentication/login using web service (SOAP) before i can send registration details? should i send this via SOAP?

    thanks again and hoping for your reply.. and get well soon Mike
    Jason

  4. #4
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Jason,
    Thanks for the reply, I am sending you a private message with my cell number so we can discuss this via phone. I am more confedent that I can explain this over the phone

    ~Mike

+ Reply to Thread

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