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.


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 –


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


Add the new fields as required: E.g. Degree Status



Leave the group by class to default value, check summary page and finish the wizard


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




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.


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.


Specify custom object JSON payload

{ “Degree_Name”:”MCA”, “Degree_status”:”Passed”, “Email_address”:””,”contact”:”797864545″ }


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.


Next, perform mapping, it’s pretty straight forward mapping since both side we have same Custom Degree object.


Once, save your integration look like below –


Specify EmailAddress as tracking field and activate integration


Once Integration activated, get the OIC Integration URL e.g.


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.


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.


Track Instance in OIC-

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


Verify Custom Object Data in Eloqua Custom Object Screen

Navigate to Audience >> Custom Object >> Select Degree CO >> View Custom Object Record




Here is the PHP Script file content –

* CPMObjectEventHandler: SendCOtoICSREST
* Package: Degree_CO
* Objects: Degree_CO$Degree
* Actions: Create, Update
* Version: 1.2
* Purpose: Trigger ICS integration for CO via REST Adapter
use \RightNow\Connect\v1_2 as RNCPHP;
use \RightNow\CPM\v1 as RNCPM;
The Actual Event Handler
class SendCOtoICSREST 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 = $obj->Degree_Name;
    $Degree_status = $obj->Degree_status;
    $Email_address = $obj->Email_address;
    //—–cURL it!
    //Add to data body for json_encoding
    $CO_body = array(
     “Degree_Name” => $Degree_Name,
     “Degree_status” => $Degree_status,
     “Email_address” => $Email_address
    //Send JSON data to test endpoint
    $json_body = json_encode($CO_body);
    //$domain = “;; //Test RequestBin
    $auth_header = “Basic bWFuaXNoLmt1Lmd1cHRhQG9yYWNsZS5jb206TDBnMW5ebjB0ZWJvb2s=”; //For ICS only
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     ‘Connection: Keep-Alive’,
     ‘Content-Type: application/json’,
     //’Accept: application/json’
     ‘Authorization:’.$auth_header //Generated using POSTMAN (ICS Credentials)
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘POST’);
    curl_setopt($ch, CURLOPT_URL, $domain);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json_body);
    $result = curl_exec($ch);
    $errno = curl_errno($ch);
    if($errno) {
     $error_message = curl_strerror($errno);
     echo “cURL error ({$errno}):\n {$error_message}”;
     $all_loaded = FALSE;
     $json_decode_result = json_decode($result);
     echo “Successful!”;
     $all_loaded = TRUE;
    //—- end curl
The Test Harness
class SendCOtoICSREST_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 = “”;
    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);
        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 🙂

Author: Manish Kumar Gupta

I am currently designated as Principal Presales Consultant in Oracle, Sydney, Australia. Having 20 + years professional experience. Currently Looking after Presales activities for iPaaS related Cloud Offering e.g. Oracle SOA Cloud Services (OSCS), Oracle Integration Cloud Service (OIC), MFT and Oracle API Platform etc. In past I have worked for many small to large companies. I have played various roles such as Integration Solution Architect / Integration Technical Architect / Integration Team Lead / Integration Specialist / SOA Infrastructure Admin / SOA Designer and SOA Developer in multiple companies. I have worked in various OFMW products such as Weblogic, OSB, BAM, SOA Suite, OWSM and Mediator etc. I have good hands-on experience in SOA Administration as well. In addition to that, have handful experience of SOA Architecture, Analysis, Design, Development, SIT Testing, Performance and Load Testing, Production and Post-Production Support for SOA projects.

2 thoughts on “Oracle Service Cloud to Eloqua Custom Object Replication using OIC”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: