I'm setting up a Wordpress site for a new customer. They have moved their customer database from a plesk environment to a salesforce database, 13 records per row including address, id, phone number, etc.

We are looking to procedurally create a page in wordpress from each customer they have in salesforce (just over 17,000 of them). I was hoping to create a php file that will run a query of all customers in the Salesforce db, and then systematically create a new row in a wordpress database as a custom page type. I can then create a website for my client that has a directory and searchable listing of all of their customers. They want a page per client, rather than a query for SEO reasons.

I'm not being super clear probably, but I just wanted to perhaps have someone experienced in salesforce validate that it'll be possible for me to run an initial query that will capture ALL customers in a table, one per row using something that'd resemble a SELECT FROM WHERE statement. Then each row will be REPLACED INTO a table on my wordpress server and that I can do that in pure PHP.

From my initial research, it appears SOQL can have queries run on it like an SQL db, but I can't seem to find a resource that shows me how, using PHP, I can log into my clients salesforce to run a query such as:

SELECT Id, Status, Code, Business Name, Address1, Address2, Zip, City, Country, State, Telephone, Fax, Website, Regdate, LastUpdated.
FROM x,y,z
WHERE Createddate > :Datetime.now().addMinutes(-90)

After I'm done with the initial import, I will be running an hourly cron task to replace any records that have been updated in the last hour. Not essential, but something to keep in mind.

I have validated that I can use SOAP on my server (which I've read around other forums and posts here may be necessary?) but I never see a field for listing the address or credentials to access my clients database directly.

EDIT: Just chucking in that I have the appropriate SOAP install, PHP version and cURL installed and the domain I am developing on has an SSL cert. As per https://developer.salesforce.com/page/PHP_Toolkit

  • Instead of polling the system periodically, you could also consider making use of Outbound Messaging. – martin Feb 22 '16 at 14:32
  • Honestly, I think that outbound messaging could work great for you if you can use SOAP webservices and, especially if all data is flowing from Salesforce → Wordpress. On the Salesforce side, you would basically just have to define the outbound message to determine which data you wanted to sync, and then add workflow rules to the objects that you wanted to sync so that the message was sent when the right changes are made to Salesforce records. – martin Feb 22 '16 at 14:55
  • You would be pushing data out of Salesforce rather than polling, but it sounds like that's probably what you would want to do anyways. – martin Feb 22 '16 at 14:59
  • thanks @martin, I'll check it out. I've messaged my client for their local and API secret key. I hope I'm correct, but I'm hoping that I can install the PHP toolkit: developer.salesforce.com/page/… I can then run a query and then a FOREACH of each outputted row to connect and INSERT into a local mysql. I'll look into the Outbound Messaging for the upkeep of the database, definitely sounds preferable to polling the server once per hour. – Many Hats Digital Feb 22 '16 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.