Pages

Friday, March 13, 2020

Manage Custom Object in Salesforce using Oracle Integration Salesforce Adapter !!!


Customisation is essential part of any SaaS implementation to capture unique business needs. In Salesforce SaaS application also, there could be several use-cases where user might need to create a new Custom Object or add custom fields into existing Standard Object such as Contact, Account and Organisation etc. In this blog I will be showing how can we add Custom Object e.g. CochOrder which can have multiple Custom Fields e.g. Order Number, Shipping Cost, Source Region, Target Region and Total Amount etc. and can update that Custom Object fields using Oracle Integration Cloud (OIC) Salesforce adapter. I must recommend you to read my other blog which I have wrote to cover adding Custom Fields to existing Standard Object such as Contact, Account and Organisation etc.  Most of the steps is going to same as previous blogs, so I am not going to repeat them here, instead will be only focusing only new changes related to Custom Objects.
Before, I go into deep drive, just want to highlight the core objective of this blog to show Salesforce configuration and OIC Salesforce adapter configuration, I am assuming reader has already basis understanding of OIC product features such as Connection, Integration, mapping and deployment.
My colleague had already covered Salesforce Inbound and Outbound integration using Oracle Integration Cloud Salesforce Adapter. So, I might not be repeating few steps which already been covered in this blog as well. if you doing Salesforce Integration first time, then its recommended to review these blogs before you proceed to read this blog.
So let's do deep dive now. Below are the high levels flow and steps which needs to be performed to achieve desired result.



  • Create Custom object e.g. "CochOrder" which contains these fields Order Number, Shipping Cost, Source Region, Target Region and Total Amount etc. inside Salesforce
  • Create/Update Salesforce Connection in OIC
  • Create REST Adapter in OIC
  • Create Integration which maps Contact Object Custom Fields from REST Adapter to Salesforce Adapter
  • Activate Integration
  • Trigger Integration using Postman
  • Verify Result In Salesforce

Create Custom Object in Salesforce
Create Custom object e.g. "CochOrder" which contains these fields Order Number, Shipping Cost, Source Region, Target Region and Total Amount etc. inside Salesforce
Login into Salesforce using your credentials and navigate to this path Setup >> Build >> create >>object >> new custom object



Specify all the fields values e.g. label, object name, record name etc. If you need to understand the meaning of any particular fields and possible values then click on "help for this page" option given at right most top corner.



Once object got created, click on that object and go the section of "Custom Field and Relationship" and define new fields for this Custom object. In our example we are going to create five fields Order Number, Shipping Cost, Source Region, Target Region and Total Amount.



Select the data type of new filed


Enter the details of new Custom Fields e.g. Order Number, length and field name etc. as per your need.


In next screen, you need to select profile who are allowed to access this new field. I haven't selected anything specific, left default value. If you have any specific requirement than select relevant profile.

  
In this screen, page layout needs to selected where this new fields will be appearing, again, I left default value.



That's it. Now, new custom field "Order Number" been created. Similarly, create other fields Shipping Cost, Source Region, Target Region and Total Amount. Once done Custom Object CochOrder will look like this-


So, now custom fields creation process is done, next we need to create connection in OIC for Salesforce.

Create/Update Salesforce Connection in OIC

In order to create connection in OIC for Salesforce, user needs Salesforce Enterprise WSDL, Token and username and password. Please refer this blog to get instruction how to get Token and Enterprise WSLD from Salesforce.
Once you get Enterprise WSDL and token, creating Salesforce Connection in OIC is pretty simple process. Login to OIC console, from home page,  navigation to Integration >> Connection >> create >> find and select Salesforce >> specify any valid String as Connection name >> Select Role Trigger and Invoke >> Create >> then configure Connectivity and Security
Configure Security: You need browse Salesforce Enterprise WSDL
Configure Security:  You need to provide your password + Salesforce Token. For example: If your password is mypassword, and your security token is XXXXXXXXXX, then you must enter mypasswordXXXXXXXXXX
And Test the connection, it must show you message "Connection SalesForceXXXX was tested successfully."



Now, we are ready with Salesforce Connection. Next Steps to create REST Adapter in OIC.

Create REST Adapter in OIC

In this steps, we need to create a REST Connection in OIC with valid Contact Object JSON Payload having Custom Field as input.
Again, navigate to Connection >> create >> find and select "REST" >> specify any valid String as Connection name >> Select Role Trigger and Invoke >> Create >> then configure Connectivity and Security
Configure Security: Specify Connection type as "REST API Based URL", TLS Version as "TLSv1.1", Connection URL as "https://mgu-oic-dev-XXXX.integration.ocp.oraclecloud.com" and leave other to default values.
Configure Security:  Provide your OIC username and password to secure this REST Endpoint.



Now, we are ready with Rest Adapter. In next steps we will be creating Integration.

Create Integration which maps CochOrder Custom Object Fields from REST Adapter to Salesforce

In this step we will be creating a new Integration, use REST Connection as source Connection, and Salesforce Connection as Target Connection and will perform mapping.

Salesforce Adapter configuration

Drop the salesforce adapter from right hand side invoke section to canvas and define the endpoint and other configuration -



Select create, select Custom and find out your Custom object. It must be listed here. In my case it was "CochOrder_c". and finish Adapter configuration.

Note:
If you are not able to find out your Custom object here, then first check the enterprise WSDL whether that object XML element are appearing there or not, If WSDL don't have corresponding XML element then obviously Custom Object won't be visible here because all these mata-data what we see in adapter comes from Salesforce Enterprise WSDL only. If you used old Enterprise WSLD in Connection before you create Custom Object than meta-data won't refresh automatically here. Generate new Enterprise WSLD and reconfigure your Salesforce Adapter.



Similarly configure REST adapter, and perform mapping. I am not going to cover those steps in details here.


Once mapping done, flow completed, activate the integration.
My Integration flow which I build was looks like something this. Highlighted area is mapping and Saleforce adapter call -



Once Integration activated, trigger request using Postman and verify Saleforce Custom Object inside Salesforce.



Login into Salesforce, go to your Custom Object page. For your Custom Object there will be dedicated page created, where you can see all newly created orders as part of this Integration flow.



That's it, as you can witness that the multiple Orders been created inside Salesforce using CochOrder Custom Object.

I hope, this blog will help you to understand how easily and simply we can add new  Custom Object in Salesforce and can perform create/update operation using Oracle Integration Salesforce Adapter.

So, stay tuned for more blogs !!!

Happy Blogging :)

No comments:

Post a Comment