Using Salesforce from Bonita Open Solution


Bonita Open Solution is an open-source Business Process Management ( BPM ). It comes with one of the best BPMN editor I have tried (Bonita Studio). The main feature of Bonita, is its extensibility, which is achieved by using either :

  • Connectors: java classes which defined the task to run, as well as the interface to configure the connector from within Bonita Studio
  • Scripts: Using Groovy scripts or Javascript through the Rhino connector
    In this example, I will show how to use a Groovy script to access Salesforce query interface, but the process described here is pretty much the same for all Java librairies you may want to use from Bonita.

First, we need to generate the JAR file for your Salesforce organization. We’ll use the Web Service Connector (WSC), which generates the JAR file from your Enterprise WSDL:

  • Download the latest WSC JAR
  • To get your WSDL, log into your organization and go to Your Name -> Setup -> App Setup -> Develop -> API. Generate the enterprise WSDL (unique to your organization) and save it as salesforce-mycompany.wsdl
  • Open a console, and run the WSC tool :
    java -classpath wsc-20.jar \
       salesforce-mycompany.wsdl salesforce-mycompany.jar
    Now, open Bonita Studio and import the two JARs (Extensions -> Add/remove)

Then, we’ll design a simple process. The first task ‘Query on Salesforce’ will perform the SOQL query on Salesforce, and format the results into human-readable HTML. The second task ‘View results’ will just present the results to the user into a form.

In the first task, add a Groovy Script Connector and enter the following script :

Save the result of the script into a new data variable called ${result}.

Finally, add a form to the second task. Insert a Text field, and sets its default value to the ${result} variable created above.

Run the process and voilà !

I’ve also been using the same scripting capabilities to post articles to my blog using XML-RPC through the wordpress-java library and it worked like a charm !

Which libraries are you gonna use ?

Tags : , ,
Categories : Software, Java


comments powered by Disqus
Copyright © 2000-2022 - Eric Abouaf