Introduction
Version 1.3 of Inforama Studio makes significant improvements to the plug-in architecture which was introduced in 1.2. In order to illustrate this we have created a plug-in for Salesforce which allows document templates to be merged with data pulled from Salesforce via their web services API. This source code for this new plug-in is available for download from SourceForge along with the rest of the Inforama Studio files. We will continue to develop and enhance the Saleforce plug-in but developers wishing to create their own plug-in will find this to be a very useful example and reference point.
Creating a custom data source
Each Salesforce Data Source is linked to a single account (organization) on the
force.com platform. In order to set up a new Salesforce data source go to
Data->Connection/Data Sources, press the
New button, choose the
Salesforce as the type of data source that you want to add and finally and configure your connection by providing:
- Name: the name of your Data Source which will be used when creating associated Data Sets
- URL: URL to the SalesForce server on which the organization is hosted.
- User: User name that is used to log in to the SalesForce.com platform
- Password: The password that is used to log in to the SalesForce.com platform.
- Security Token (optionally) - a token used to access SalesForce from outside your company's trusted network.
In order to (re)generate the security token log in to your Salesforce account, then go to Setup->My Personal Information and click "Reset My Security Token".
Configuring the Salesforce datasource
 |
Creating Data Sets from SalesForce data source
Data Sets created out of SalesForce Data Sources are defined by SQL-like SalesForce Query language. More inforamtion on the language itself can be found here:http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content%2Fsforce_api_calls_soql.htm|SkinName=webhelp. The screenshot below shows a sample query that retrieves all of the organization/company.
Configuring the Salesforce dataset
 |
Once the data set is created it can be used as any other data set within document templates. The screnshots below shows both the template and result document listing all organization's contacts defined by the data set above.
Outputting Salesforce data
 |
The generated document
 |
Another part of the SalesForce plugin is the ability to associate document generation with a selected organization's contact retrieved from the SalesForce platfrom. This feauture is a basic example of how the Inforama and SalesForce platform can be integrated.
The steps below describe how to create a document showing details of the selected organization's contact.
Create the Sales Force Data Source
Go to Data -> Connection/Data Sources, in the "New Datasource" dialog select "SalesForce", click next and enter your SalesForce settings. You can test your connection by pressing the "Test Connection" button.
Create the required SalesForce data set
The definition of the data set used in the example is as follows:
select id, firstname, lastname, email, homephone, department, birthdate from Contact where id='$P{sf_contact_id}'
Dataset definition for a specific contact
 |
the $P{sf_contact_id} is a reserved parameter indicating the ID of the selected organization's contact.
Creating the document
Create a new Letter template showing the contact's detail. An example of this is shown on the screenshot below.
and then create a compound document consisting of that letter.
Document template for the specific contact
 |
Once you've created the document open the Sales Force Contact Dialog by clicking SalesForce->Contacts, choose the Sales Force data source that should be used, provide a search criteria and press the search button.
Salesforce contact search page
 |
Choose the contact against which you want to run the document generation proccess, press the run generator button and follow the document generation proccess for the document you've created previously. The required sf_contact_id parameter will be populate with the id of the selected contact.
Passing the selected contact id
 |
Preview or Save the document once it has been generated. The screenshot below shows the output document generated from the previously created letter template and filled with the selected contact's details.
The generated document for the specific contact
 |