Monday, June 13, 2016

#509 ICS --> Orchestration example

Here is a simple example of using the Orchestration pattern in ICS.

In this scenario, before creating a new organization in Service Cloud, I first check whether it already exists. The processing logic is very simple -

IF the organization exists

THEN
Mark created status as ‘false’
Return the existing Org ID and name.

ELSE
Create the account in Service Cloud (RightNow),
Return the newly created Org ID and name.


Here is my connection in ICS -









I also create a REST connection for Inbound.











As this is being used for inbound, Connection URL can be set to any value.

Test the connection -









Create the Integration




























The integration is created -



















Note the Triggers panel on the left - We define what triggers the integration.
In our case, it is the REST connection.

I drop my REST connection on to the Start area.




















































On the next page, I provide the query parameters -














In my case, just one - the Organization name.

The Response will be based on the following file -











































































Now I add a Lookup Organization Call by selecting my Service Cloud (RightNow) connection from the Invokes list.

When dragging it onto the canvas, blue + icons appear.
I drop it on the first of these and configure as follows -











































Now I need to Map the data for the LookupOrganization callout.


















































Now, I need to add some conditional logic after the Invoke of LookupOrganization.

I will use the Switch action for this.













































I configure as follows -

First, the Undefined path -


















The above screenshots should be self explanatory.

If the Org already exists, I want to return its ID and name.
So I add a Map Action after the condition.

















This is the Target -















I will set Created to 'false', as it already exists.










Then I map the ID and NAME.







































Now I need to add the Create Organization call to the Otherwise path.

I select the connection from the Invoke list and drop after Otherwise.


























Do the Mapping - CreateNewOrg.











Note: I have filtered to show only mapped fields on the Target.











Nearly finished, just need to set the reply, if the Organization has been created.
To do this, I drop a Map action after the CreateNewOrg invoke on the Otherwise path.

















Map as follows -
















Last step is to delete the now unnecessary map action -































































I add Tracking, based on the Org name.

I then Activate the Integration.
















The URL is in the following format -

https://YourICSEnv/integration/flowapi/rest/YourIntegration/v01/metadata

I now try this out in a browser -












All I need to do is replace metadata with my OrgName
e.g.
https://YourICSEnv/integration/flowapi/rest/YourIntegration/v01/organization?name=HarmonstownInc.

Here is my response -










I check for the Org in Service Cloud -















I execute the request again -









No comments: