Tuesday, July 23, 2019

#720 OIC - Salesforce Adapter - Updating Data

Updating a lead in SFDC























Very simple example here - I update my Lead Jimmy's email address.








Here is my orchestration logic -










I used SOQL, as discussed in the previous post, to check whether the lead already exists.











If so, I update accordingly -









I test with the following payload -










I validate in SFDC









#719 OIC - Salesforce Adapter - Querying data



Pre-requisites


Firstly, there are some pre--requisites that need to be fulfilled before OIC can interface with SFDC.

OIC leverages the SFDC enterprise wsdl to connect to SFDC.
First step is to login to SFDC and download this wsdl -









































Save this file locally.

Create the SFDC Connection in OIC















I then add the user/password - that's it.


Now to a simple example...

Leveraging the SFDC Connection in OIC to Query Data


Here is a simple example where I query SFDC Leads.




















Let's look at the options here -

Query -






















Query is based on Salesforce Object Query Language (SOQL)

Retrieve is based on object ID

Search -









Search leverages Salesforce Object  Search Language (SOSL)

SOQL

For those new to it - akin to ROQL from Service Cloud.

Here is a simple example - first to my Lead in SFDC














Now to query Jimmy via the OIC SFDC adapter -





















For those new to SOQL, note the query reference link -













Now to add a couple of more fields to the query -
A complete LEAD field list is available here







































Retrieve

Now that I have Jimmy's Id I can leverage it to retrieve his data -














Simple stuff!

Search / SOSL

Note: 2 rows returned.

...
         The Hare of the Dog Pub
         jimmy@hotd.ie
         Jimmy Keenahan
         ...  
         Delphi Chemicals
         tom.james@delphi.chemicals.com
         Tom James
         Working - Contacted

Well Jim is short for James.

SOSL docs can be found here 

















OIC - Simple, Succinct = Success.

Tuesday, July 16, 2019

#718 OIC Process - Decisions: Contexts, Lists, Relations and other features

Leading on from the previous post -

Again, text taken from the Oracle docs in italics.


There are a couple of more goodies in the Decisions pack.

Contexts

A context is a collection of one or more key-value pairs with an optional result field. Each pair is called a context entry. The key attribute within a context entry acts as an identifier to its corresponding value attribute. You can use a context to collectively document all decision logic related to a particular scenario or entity. Say you need to determine the loan eligibility of an applicant, based on the applicant’s net monthly income and expense. For this purpose, you can create a decision named Loan Eligibility using the Context notation and add expressions or
logic for gross monthly income, monthly expense, and net monthly income. Then, you can either add a result field (within the context) that evaluates the net income and expense for loan eligibility, or you can choose to evaluate these within another decision.

Ok, so let's try this out, based on our Order payload  -



I can now test this -

first with a small order...










then with a large order...










Very succinct and easy to use.

Contexts can be referenced from Decision Tables -























Lists

A list notation is a vertical list of elements, where each element is an independent logical
notation. The output of a list notation contains outputs of all its elements. You can
also invoke the output of a particular list element from another decision.


Now did you understand the above?
Let's make it a bit more tangible. Here is my list, containing 5 products.

























Lists can be referenced in Decision Tables -






















Here I am setting the discount to the sum of the entries in the Product List.
Makes no sense from a functional perspective, but just to illustrate usage.




Relations















Think of a DB table e.g. Products relation


























So now to a simple test - using the Decision table from the previous post -


















Line 6 makes no functional sense, but demonstrates how one can leverage
relations in a DT.

I will enter an order for 123 items with a total value of 12000.
As this has a hit policy of C+ we should get a final discount based on the
values for the 3 rules which will fire (Rules 4,5,6) so that is
16+25 + price of the iBike, 1300 = 1341

Test -



 

Functions

You can create functions to define specific operations that aren’t available through
built-in functions. In Process, decisions created using the Function notation return a
value only when invoked from another decision.



Functions can be called from a DT.


Test with the following payload -



Imbolc Discount defined as -
(price * quantity) / 100

Do the math - 1234 * 8 = 9872.
Divide by 100 = 98.72


Loops

Create loops to iterate over lists or arrays. Using the loop logical notation, you can
create three different types of loops, namely For, Some, and Every.

• For: Iterates over a list and returns an expression.

• Some: Checks if at least one list item satisfies the test condition defined by an expression
and returns a Boolean value.

• Every: Checks if every list item satisfies the test condition defined by an expression
and returns a Boolean value.




















I test...





Note: the loop executes for each member of the list [1,2,3,4].

Check out the other operation options -


Some:

Test...


Every:


Test...