As I’ve mentioned in previous posts, I use MediaWiki as an intranet for my non-profit organization. It’s been a great way to document our implementation of Salesforce.
With a number of users creating their own reports, I was looking for a way to document all the custom objects and fields we have. Moreover, I wanted it to dynamically update when future changes where made. So, I started playing with PHP and the Salesforce API as I’ve done for other useful widgets we use. Using the describe call, I was able to start retrieving that meta-data with a lot more detail than I expected.
The harder part involved shoehorning the standalone php code into the proper format of a MediWiki extension. After getting over that learning curve, I started getting ambitious and added a query option to the extension so end users could retrieve records using their own select statements. While writing queries using the api is bread and butter stuff, it was an interesting exercise to write code that could accommodate a user defined query. Normally, the select statement is hard coded as are the output fields. In this case, I had to write code that could handle any number of fields at runtime. Moreover, it had to handle queries that could potential reference multiple objects and use varied notation styles. After a number of trials using string parsing, I was able to come up with a half-way elegant solution looping through the Sobject arrays. It’s funny what makes geeks proud. **pats self on back**
So after cleaning it all up and commenting the hell out of it, my baby is ready for the world. Version 0.1.0 of the Salesforce/MediaWiki Extension took its first steps today. Make your Papa proud.
Note: Don’t post requests for troubleshooting here. Add them to the MediaWiki page, http://www.mediawiki.org/wiki/Extension:Salesforce. Thanks.