Pages

Monday, April 15, 2019

Oracle Service Cloud to Eloqua Contact Create/Update using OIC !

Recently, I have been worked for different use-case scenarios between Service Cloud to Eloqua Integration using OIC, hence thought to publish this blog to cover all those scenarios.
This is first in series which will use standard business Contact object data replication, there will be two more blogs, one covering Custom Object replication and another one will be importing data in bulk from Service Cloud to Eloqua.
Before, I start showing the steps how Contact Business Object data can be replicate from Service Cloud to Eloqua. I need to emphasis the important of Service Cloud Adapter and Eloqua Adapter.
Oracle Integration cloud is the strategic product from Oracle for Integration. It has 60+ adapters which simplifying the Integration between heterogeneous applications. For this use case, I am using Rightnow Adapter and Eloqua Adapter. Rightnow adapter help to connect to Service Cloud and Eloqua Adapter for Eloqua system. Below is some of the important capabilities both adapters offers.

Service Cloud/ Rightnow Adatper Capabilities - 

  • Integrates easily with the Oracle Service Cloud application’s WSDL file
  • Enables you to perform CRUD (create, get, update, and destroy) operations against Business Objects
  • Support Service Cloud Event subscription for standard Business Object such as Contact, Incident and Organization (Trigger end)
  • Supports the Righnow Object Query Language (ROQL) to query metadata information (Invoke end)
  • Support Service Cloud Custom Object and attributes
  • Automatically handles security policy details required to connect to the Oracle RightNow Cloud application.
  • Provides standard error handling capabilities

Eloqua Adapter Capabilities - 

  • Integrates and accelerates Integration with the Oracle Eloqua System
  • Provide support for trigger and invoke both role
  • Enables you to perform import operation for Business Objects e.g. Contact, Accounts, Opportunities etc.
  • Support Custom Object and attributes
  • Automatically handles security policy details required to connect to the Oracle Eloqua application.
  • Provides standard error handling capabilities

Use Case: 

Contact business object is the standard object which exists in both sides. Its very common scenario when Contact gets created in Service Cloud that's need to be replicated to Eloqua as well or vice versa. In this blog I have focused on Service Cloud to Eloqua, but I may write another one which will show Eloqua to Service Cloud Contact object replication.
Service Cloud support event trigger mechanism, Service Cloud Adapter well developed to accomodate Service Cloud Event trigger for Contact, Incident and Organisation object only.
Below are the high level steps which needs to perform to Sync Contact business object from Service Cloud to Eloqua.
pic01

OIC- Create Service Cloud Adapter Connection 

  1. Logic to OIC console, select "Integration>>Connection"Pic02
  2. Double Click on the connections to create the Service Cloud (Rightnow) connection, click on the create button and Select the Oracle Rightnow adapter from the list of adapters shownpic03
  3. Provide the name, Role as “Trigger and Invoke” and Description and click on Create.
  1. Please provide the WSDL URL and user name and password in the connector by clicking on the Configure Connectivity and Configure Security appropriately, save it and test it.
The WSDL will be in the format of
https://Site.rightnowdemo.com/services/soap/connect/soap?wsdl
e.g.  https://rnowgse00269.rightnowdemo.com/services/soap/connect/soap?wsdl
Once the connection tested it will be ready to be used in any integration flows.
pic04

OIC - Create Eloqua Adapter Connection

Double Click on the connections to create the Eloqua connection, click on the Create button and Select the Eloqua adapter from the list of adapters shown
Picture5
Supply the details of the Name of the new Connector (any meaningful name) and select the Role as “Trigger and Invoke” also provide a description .
Please provide the Company Name, User id and Password and test the connection and save. Sample is given below. You can get all these details from Eloqua Administrator who manage the Eloqua Site.
Picture6

OIC – Create Integration

Once the connectors are configured, the integration flow has to be created for the use case of Contact Creation sync from Service Cloud to Eloqua.
Click on the Create in the Integration Designer as shown below and select the style for the integration as “Basic Routing”.
Note:  I have selected basic routing just for quick implementation but that's not the recommended integration pattern, better selecting apps orchestration one which will offer much better orchestration capabilities.
Picture7.png
After this provide the name of the integration in the place holder as shown below
Picture8
Next step is to Drag and Drop the Source connector and target connector for the integration
Picture9
Since we have to capture the Source event subscription from Service Cloud and we have to sync it to Eloqua, select the Rightnow connector on the Trigger side and Eloqua connector on the invoke side of the integration.
The Next step is to Configure the End point of the Service Cloud
Picture10.png
In the Event Subscription select the Contact Created Event in the configuration parameters
Picture11.png
Select the response as none and click Done.
Similarly, for the Eloqua connector we have to configure the endpoint configuration parameters.
Picture12.png
Select Contact from the Business Object option and the operation as “Import” and the Fields that needs to be mapped from the list. We also have to select the Unique Match field based on which the contact will be created on the Eloqua side. Please choose “Email Address”
Picture13.png
Once you have done this, you will have the summary
Picture14.png
Click on done to close.
The next step is to create the mapping between service cloud and Eloqua. From the Source please select the elements to be mapped to the Target.
Picture15.png
Validate the mapping once done to check the correctness.
Need to configure the Tracking identifier for monitoring the integration flow. This is mandatory before activating /deploying the integration. Select any field you wish based on which you want to track the integration.
Picture16.png
Once the tracking is done, Activate the integration by moving the slider for specific integration Picture17.pngfrom left to right. Optionally you can select “include payload” option as well, if you will to see the xml payload.
Picture19.png
Once the Activation is done Picture18.pngwill indicate the success.

Service Cloud Configuration

In order for the Right now adapter on the Oracle integration Cloud to receive the Event Subscriptions from Service Cloud the OIC username and password need to be configured in the Service Cloud under Configuration Settings.
Service cloud offers .net based desktop application to allow all sort of action for Service Cloud instance. In order to install desktop version of service cloud.
Navigate to site URL e.g. https://rnowgse00xxx-x.rightnowdemo.com/cgi-bin/rnowgse00xxx_x.cfg/php/admin/launch.php  of Service cloud and click “Install Oracle Service Cloud” option. It will download the file, run that file and it will install desktop version in your Window machine.

Once installed, go to start menu and type right now and you will see the instance of your Service Cloud environment. Simply click on that and provide credential to login.












Login to the Agent desktop with admin credentials, Click on the navigation>>site configuration >> Configuration setting and search for “Key=Event*” and update below values –
  • EVENT_NOTIFICATION_ENABLED– Set it to ‘Yes’ for the Site. This is the global setting that enables ENS.
  • EVENT_NOTIFICATION_MAPI_USERNAME – Enter a valid Service Cloud username.
  • EVENT_NOTIFICATION_MAPI_PASSWORD – Enter the corresponding password.
  • EVENT_NOTIFICATION_MAPI_SEC_IP_RANGE – This can be used for specifying whitelisted subscriber IP Addresses. All IPs are accepted if kept blank.
  • EVENT_NOTIFICATION_SUBSCRIBER_USERNAME– Enter the OIC credentials. Service cloud use these credentials to send the event notification to OIC
  • EVENT_NOTIFICATION_SUBSCRIBER_PASSWORD – Enter the password.
Note: In below snap ICSUser is the user exist in Service Cloud and manish.ku.gupta@oracle.com is the user for Integration Cloud.
Picture23.png

Testing

Test the integration by creating a contact in Service Cloud and save. You can monitor this in the Integration Cloud under the monitoring tab and select the appropriate integration flow.
Login to Eloqua and navigate to Contacts to see whether the new contact is created successfully with all the values as per the mapping you did in the integration flow.
Login to Service Cloud Web Browser, click + sign right hand side top, select contact and add new contact and hit save.
Picture24
Go to OIC and check transaction. Monitoring >> tracking
Picture25
Login to Eloqua and search for contact
Picture26

Update Contact from Service Cloud To Eloqua

In Contact update scenario everything will be same as listed above except inside Integration when you drag and drop Service Cloud Adapter instance you will be choosing "Contact Update".
Picture27.pngRest of the artifacts and process will be same and when you modify the contact, it will update same contact value in Eloqua.
I hope this blog help you to build the Contact replication between Service Cloud to Eloqua.
There are two blogs going to cover Custom Object replication and Bulk Data import from Service Cloud to Eloqua. Stay Tuned :)

Oracle Service Cloud to Eloqua Custom Object Replication using OIC !!!

In my previous blog I have focused on how Standard Business Object e.g. Contact can be replicated from Service Cloud to Eloqua.
Now, in this blog focused will be, how Custom Object can be replicated from Service Cloud to Eloqua.

Usecase:

Currently, Service Cloud Adapter only support 3 business object event processing through adapter 1) Contact 2) Incident and 3) Organisation.
If you need to process the event for any other objects, other that what listed above then you need follow the path of Custom Object, Custom Event, associate Custom Event to Custom Object etc.
In this example use-case, I will be creating a Degree Custom object which will hold the value of Contact's degree information e.g. Degree Name, Degree Status, Email address etc and data will be replicated from Service Cloud to Eloqua whenever that degree object gets created.
Below are the high level steps needs to follow -
Pic01.png

 

Eloqua - Create Custom Object

Login to Eloqua.
Navigate to Audience >> Custom Object and Click on Create New Custom object as belowPicture2
Give the name of the Custom object and the default linking field and click next
Picture03
Add the new fields as required: E.g. Degree Status
Picture04
Picture06
Leave the group by class to default value, check summary page and finish the wizard
Pictureo5

Service Cloud - Create Custom Object 

Custom object can be created using Service Cloud Desktop agent only. Installing and accessing desktop agent I have already covered in my previous blog.
Login to Agent desktop. and navigate to the Navigation>>Database>>Object Designer >> New Package




Picture08
Once package gets created, add degree object













Create new field by clicking the Add New Fields on the header and save with appropriate data type and length







Once the fields are created, Click on Deploy Picture12and then immediately for it to get deployed and to be used in the integration flow.

Service Cloud - Create Custom Event Handler

So, far we have created Custom object and added some fields into it. In next step we have to add custom event handler because Service Cloud Adapter doesn’t support Custom object event trigger using standard event subscription process.
Hence, we need to use alternate approached offered by Service cloud which “Custom Process” is wherein we can design custom event handler and attach to Custom object. Custom event handler can invoke a PHP script which in-turn invoke OIC Integration URL using cURL method and pass data in JSON format.
We also need to associate Custom object to read/update/delete operation in order to invoke Custom event handler.
So, follow below steps to do that.
Navigate to Navigation >> Site Configuration >> Process Designer



Click new to create new object event handler, give some value name e.g. SendCOtoICSREST, browse the php file e.g. SendCOtoICS.php which you have written to invoke OIC Integration, once you browse the file and open it, save it, Test button gets highlighted, click test button and state should show “Tested” in green color. If PHP has some error, you will see error. The PHP script will be visible in this screen read only format.
Note: PHP script was provided by Service Cloud Engineer or refer Service Cloud document how to prepare PHP script, make sure you modify OIC Integration URL, username and password inside PHP script.
I will include SendCOtoICS.php content at the end of the blog. 




Once event handlers get created, go back to Custom object what you have created and associate this event handler to various operation possible on that custom object. Refer below snap –



In above snap, custom event handler getting linked to Custom object create and update operation.

OIC - Create REST Adapter for Service Cloud Consumption

Since we need to expose OIC integration as REST API, we need to use REST Adapter as trigger point for Service Cloud to Invoke OIC Rest Integration API. So, create a REST Adapter which will be used to Invoke OIC Integration with basic authentication.
Picture16.png

OIC - Reuse Eloqua Adapter connection

In previous blog, we have already created Eloqua connection, so use the same connection for Eloqua.

OIC - Create Integration

Now, both source and target connection ready, start building integration, select basic routing integration and drop Service Cloud REST connection on left hand side, wizard get open, specify all standard stuff e.g. endpoint name, endpoint resource relative URI, post method, tick on configure request payload option.
Note:  I have selected basic routing just for quick implementation but that’s not the recommended integration pattern, better selecting apps orchestration one which will offer much better orchestration capabilities.
Picture17.png
Specify custom object JSON payload
{ "Degree_Name":"MCA", "Degree_status":"Passed", "Email_address":"manish.ku.gupta@oracle.com","contact":"797864545" }
Picture18.png
Similarly, drop Eloqua Connection on right hand side, wizard will get open, specify endpoint name of your choice, select “Degree CO” custom object, select the fields, link to email Contact.EmailAddress CDO this degree object as per given snap.
Picture19.png
Next, perform mapping, it’s pretty straight forward mapping since both side we have same Custom Degree object.
Picture20.png
Once, save your integration look like below –
Picture21.png
Specify EmailAddress as tracking field and activate integration
Picture22.png
Once Integration activated, get the OIC Integration URL e.g.
https://mgu-oic-dev-apacanzset01.integration.ocp.oraclecloud.com:443/ic/api/integration/v1/flows/rest/SYNCDEGR_SRVCLOUDREST_TO_ELOQUA/1.0/srvCloud/syncCustomObject
Picture23.png
Once OIC Integration URLs gets generated, update PHP script with this URL, go back to Service Cloud Custom Event Handler, update php script, browse updated PHP script, , Save it, Test it and Deploy it.

Testing

In order to trigger this integration, Custom object needs to be created, for that you need a Custom Object UI. Talk to Service Cloud expert or documentation, how a Custom UI can be created in Service Cloud to show Degree Custom Object. Insert the new record using that UI, which eventually trigger the Integration using PHP cURL command and OIC will update Eloqua with Custom object records.
Picture24

Track Instance in OIC-

Jump to OIC >> Integration >> Monitoring >> Tracking to see the latest instance of this event.
Picture25.png

Verify Custom Object Data in Eloqua Custom Object Screen

Navigate to Audience >> Custom Object >> Select Degree CO >> View Custom Object Record
Picture26
Picture27
===========================================================================

Here is the PHP Script file content -

/*
* CPMObjectEventHandler: SendCOtoICS
* Package: Degree_CO
* Objects: Degree_CO$Degree
* Actions: Create, Update
* Version: 1.2
* Purpose: Trigger ICS integration for CO
*/
use \RightNow\Connect\v1_2 as RNCPHP;
use \RightNow\CPM\v1 as RNCPM;
/*-------------------------------------------------------------------------------------
The Actual Event Handler
-------------------------------------------------------------------------------------*/
class SendCOtoICS implements RNCPM\ObjectEventHandler{
  public static function apply($run_mode, $action, $obj, $n_cycles)
  {
    if ($n_cycles !== 0) return;
    $DegreeCO = RNCPHP\Degree_CO\Degree::fetch($obj->ID);
    $Degree_Name = $DegreeCO->Degree_Name;
    $Degree_status = $DegreeCO->Degree_status;
    $Email_address = $DegreeCO->Email_address;
    date_default_timezone_set('UTC');
    $now = date("c");
    $oneminlater = date("c", strtotime($now) + 60);
    $now = substr($now, 0, -6).".100Z";
    $oneminlater = substr($oneminlater, 0, -6).".100Z";
    echo("
Now_date = $now \n");
    echo("
oneminlater = $oneminlater \n");
    $message='
    
      
        
          2018-08-27T09:26:29.509Z
          2018-08-27T09:27:29.509Z
        
        
          cloud.admin
          blearY@9ChaIr
          FE/VqPZeA0l/LJWm3cTZ0g==
          2018-08-27T09:26:20.605Z
        
      
    
    
      
      
        
          
        
         '.$Degree_Name.'
         '.$Degree_status.'
         '.$Email_address.'
      
    
    
    
';
    $url = "https://OICNZic-gse00014606.integration.ocp.oraclecloud.com:443/ic/ws/integration/v1/flows/rightnow/DEGREESVCTOELQ/1.0/";
    $header = array(
            "Content-type: text/xml;charset=\"utf-8\"",
            "Accept: text/xml",
            "Cache-Control: no-cache",
            "Pragma: no-cache",
            "Content-length: ".strlen($message),
      );
  //  echo("about to send request to $url");
//logMessage("REQUEST:");
echo ("
REQUEST-MESSAGE placed = $message");
    load_curl();
    $soap_do = curl_init();
    curl_setopt($soap_do, CURLOPT_URL, $url );
    curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20);
    curl_setopt($soap_do, CURLOPT_TIMEOUT, 20);
    curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
    curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($soap_do, CURLOPT_POST, true );
    curl_setopt($soap_do, CURLOPT_POSTFIELDS, $message);
    curl_setopt($soap_do, CURLOPT_HTTPHEADER, $header);
    curl_setopt($soap_do, CURLINFO_HEADER_OUT,   true);
    $response = curl_exec($soap_do); //invoke the external endpoint using the attributes gathered above e.g. messsae, url, header,
    echo("
RESPONSE RECEIVED = $response");
    //$obj->CustomFields->c->Siebel->XMLResponse = $response;
    /*$info = curl_getinfo($soap_do);
    echo "
CURL - INFO:".'
';
    foreach ($info as $key => $value){
      echo "        \t $key: $value
\n";
    }*/
    curl_close($soap_do);
  }
}
/*-------------------------------------------------------------------------------------
The Test Harness
-------------------------------------------------------------------------------------*/
class SendCOtoICS_TestHarness implements RNCPM\ObjectEventHandler_TestHarness{
  static $myobject = null;
  public static function setup()
  {
    $DegreeCO = new RNCPHP\Degree_CO\Degree();
    $DegreeCO->Degree_Name = "Test Degree Name";
    $DegreeCO->Degree_status = "Test Status";
    $DegreeCO->Email_address = "test@test.com.invalid";
    $DegreeCO->save();
    self::$myobject = $DegreeCO->ID;
  }
  public static function fetchObject($action, $object_type )
  {
    $degree = $object_type::fetch(self::$myobject);
return array($degree);
  }
  public static function validate($action, $object )
  {
    echo "Test Passed!!";
    return true;
  }
  public static function cleanup()
  {
    if (self::$myobject)
    {
        $DegreeCO = RNCPHP\Degree_CO\Degree::fetch(self::$myobject);
        $DegreeCO->destroy();
        self::$myobject = null;
    }
  }
}
=====================================================================
I hope this blog help you to integrate Service Cloud to Eloqua using Custom Object Event Trigger mechanism. I will be writing another one where you can witness Bulk data import from Service Cloud to Eloqua. So stay tuned :)