Select Page

Business Rules with Salesforce.com

by | Jun 15, 2015

Over the past few months, InRule has focused on providing deeper integration between Salesforce.com and the InRule rule engine.

This post is a follow up to my earlier post on Salesforce with InRule. That post can be found here. Please read the first few paragraphs from that post for an overview of how Salesforce and InRule add business value when used together.

This post focuses on a step-by-step walkthrough of new tools developed by the InRule Services (ROAD) Team. These tools help to further integrate Salesforce with business rules, and allow for a wide range of business logic problems to be addressed without writing any code.

As an example, consider a financial services application running in Salesforce. The application allows a financial services agent to review an existing customer’s investment portfolio and then automatically calculate a set of financial recommendations for the customer. The recommendations calculation must consider many different related objects and fields when making decisions. Some questions the calculation considers include “what is the family make-up of the Customer?”, “what other holdings does this customer already have with our company?”

A screen shot of the Salesforce application is below. This application uses the Contact object in Salesforce as the root data record for the business problem.

The built-in Contact object in Salesforce has been modified with a few custom fields. The Contact object has been related to other custom objects, such as Family Members, Trades, and Holdings. Salesforce can provide out-of-the-box configuration for the data model and user interface, but how can complex sets of business rules be applied to the sets of related Salesforce objects to calculate financial recommendations?

Using the latest rule authoring tools and framework developed by the InRule Services Team, the following steps can be used to integrate business rules with Salesforce data without writing any additional code:

Import the Salesforce object schema into irAuthor using the Salesforce extension for irAuthor

Author business rules against the Salesforce object tree

Test the rules with real-time Salesforce data using irVerify and the Salesforce extension for irAuthor

Publish rules to the cloud using irCatalog

Configure the Contact form in Salesforce to run business rules on the Contact and its related objects

Step 1: Import the Salesforce Objects into InRule
The Salesforce extension for irAuthor appears in the irAuthor ribbon control. It can scan Salesforce for available objects so that the objects can be selected and imported into InRule for rule authoring. Below is an example of selecting some fields on the Contact. Relationship fields such as lookups and collections can also be imported when working with a tree of objects.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After the Contact object and its relevant related objects have been imported into irAuthor, the rule application schema is ready for rule authoring. The imported Salesforce object structures can be extended to include calculated fields, data points from other systems, and temporary fields that are used only by rules.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 2: Author the Business Rules
Once the InRule entities are created, the rule author can now write business rules against the Salesforce object structures. The InRule rule engine supports a wide array of rule structures, functions, and actions that can operate on the data– two examples have been included below:

A Decision Table to author a tabular set of conditions and outcomes:

 

 

 

 

 

 

 

 

 

 

 

 

A Business Language Rule that lets the author express business logic against Salesforce data in an intuitive format:

Step 3: Test the Business Rules using Data from Salesforce
The Salesforce extension for irAuthor includes the ability to test business rules using real-time data from Salesforce. The rule author can immediately test logic as the rules are developed. If Salesforce object relationships have been imported into the rule application, all related data is automatically loaded into the tester. The rule author can execute the rules and verify results.

 

 

 

 

 

 

 

 

 

 

 

Step 4: Publish the Business Rules to Salesforce
Once the rules have been tested, they can be published to the cloud using irCatalog. A rule execution service running in the cloud can then use the rules during runtime requests from Salesforce. The irCatalog service keeps track of rule revisions over time.

 

 

 

 

 

 

 

 

 

 

 

Step 5: Configure Salesforce to call InRule and Execute Business Rules
Now that the rules are published, Salesforce can call an InRule rule execution service to run rules. The InRule Services framework for Salesforce includes Apex classes that send a request to the rule service. The Apex code processes rule results and saves changes back to Salesforce. The Apex classes have been designed so that they are reusable for multiple business problems and multiple sets of Salesforce objects.

In the sample financial services application, the default Contact screen has been customized to show relevant fields, and also include a button called “Get Recommendations.” When the custom button is clicked, it initiates a call to a Salesforce Apex class. The Apex class in turn executes an InRule service request to run rules. The Apex class processes the rule response and saves changes to the Salesforce objects. In the sample below, the Recommendations and Risk Profile fields that were modified by rules are displayed on an updated Contact form.

Software Architecture Overview:
The “no code” integration noted above requires the setup of a framework of software components. These components allow for rule execution and management in the cloud, along with Salesforce integration with robust rule authoring and testing. A logical architecture diagram is included below:


Summary:
After an initial deployment of software components, InRule can enable complex business logic integration with Salesforce.com without writing any additional code. InRule looks forward to continuing to build upon the services code samples, and providing deeper integration with Salesforce in the future.

In the meantime, if you are interested in sample code used for any of the components noted in this article, please contact the InRule ROAD Services Team for more information.https://

BLOG POSTS BY TOPIC:

FEATURED ARTICLES:

STAY UP TO DATE

We’d love to share company and product updates with you! Please enter your email address to subscribe to monthly updates from InRule. 

If at any time you want to unsubscribe, you can easily do so by clicking “unsubscribe” at the bottom of every message we send or visiting this page.