Slideshow transcript
Slide 1: Salesforce Integration with PHP A Sydney PHP Group Presentation April 3rd 2008 Toivo Talikka http://totaldata.biz
Slide 2: Salesforce.com On-demand CRM vendor software as a Service (SaaS) CRM and business applications Application Exchange APEX Developer Network Standard Objects: Account Contact Opportunity Lead Customers can add own fields
Slide 3: User Interface
Slide 4: Integration With PHP Web Services API PHP Toolkit
Slide 5: PHP Toolkit Self Service Portal Toolkit For PHP 5 v0.9.1 11 May 2006 Embeds Self Service Portal to a website Authenticate user, login to Salesforce PHP Toolkit 11 v11.0b 15/2/2008, supports API v11.1 Web Service API calls Requires PHP 5.1.2+ SOAP enabled SSL enabled
Slide 6: Web Services
Slide 7: Data Model Entity Relationship Diagrams for objects Sales Accounts, contacts, opportunities, leads, campaigns Task and Event Support Document, Note and Attachment User and Profile Record Type Product and Schedule Sharing and Team Selling Customizable Forecasting Territory Management Process
Slide 8: Sales Objects
Slide 9: SOQL Salesforce Object Query Language 500 row limit to rows in the query result object in a query or queryMore call Client application can change batch size in QueryOptions of SOAP header before invoking the query call Daily maximum number of API calls
Slide 10: SOQL Comparison operators: = != < <= > >= like: case insensitive matching Wildcards % and _ Logical operators: and, or, not Boolean filtering where BooleanField = TRUE where BooleanField = FALSE
Slide 11: Multi-Select Picklists 'AAA;BBB' means 'AAA' and 'BBB‘ MSP1__c = 'AAA;BBB' : exact match MSP1__c includes ('AAA;BBB', 'CCC') either: AAA and BBB selected or: CCC selected
Slide 12: Relationship Queries Must have relationship between objects to create a join in SOQL Only one level of parent-to-child relationship can be specified in a query SELECT Account.Name, (SELECT Note.OwnerId FROM Account.Notes) FROM Account
Slide 13: Query Example Company and contact details Select Id, Name, Type, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry, Phone, Fax, Website, (SELECT LastName, FirstName, Title, Email, FROM Account.Contacts ) FROM Account WHERE id = '00120000001pKpFAAU'
Slide 14: Returned Objects $query = "SELECT Id, FirstName, LastName from Contact"; $queryResult = $mySforceConnection->query($query); $records = $queryResult->records; foreach ($records as $record) { $sObject = new SObject($record); echo "Id = ".$sObject->Id; echo "First Name = ".$sObject->fields->FirstName; echo "Last Name = ".$sObject->fields->LastName; }
Slide 15: Relationship Query $query = 'Select a.Id, a.Name, a.Type, '; $query .= ' a.BillingStreet, a.BillingCity,'; $query .= ' a.BillingCountry, a.Phone, a.Fax,'; $query .= ' (SELECT c.LastName, c.FirstName, c.Title, c.Email FROM Account.Contacts c)'; $query .= ' FROM Account a'; $query .= " WHERE Id = '".$account_id."'";
Slide 16: queryResult Array foreach ($records as $record) { $Account = new SObject($record); $id = $Account->Id; $name = $Account->fields->Name; … $Contact_query_result = $Account->queryResult[0]; $Contacts = $Contact_query_result->records; foreach ($Contacts as $Contact) { $first_name = $Contact->fields->FirstName; $last_name = $Contact->fields->LastName;
Slide 17: Objects and Arrays Select c.FirstName, c.LastName, a.Name FROM Contact c. c.Account … $Contact = new SObject($record); // echo var_dump($Contact); // echo print_r(get_object_vars($Contact); $first_name = $Contact->fields->FirstName; $company = $Contact->sobjects[0]->fields->Name;
Slide 18: APEX Data Loader Download tables as CSV files Test queries before using API




Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 2 (more)