Simple Use Case
As the sages say, its a gift to be simple and I'm fully d'accord with that.I have been asked to detail how to sync contact details from SurveyMonkey to Netsuite.
Ok, said I to myself, let's do it!
It was only afterwards that I started considering what would be a valid use case from a business perspective.
I came up with the following use case -
A B2B scenario - I keep a list of customer contacts in SurveyMonkey.
AS you can see, I have 2 customers Commiskey Inc. and MacCumascaigh c.t.
Commiskey Inc has 2 contacts
Mac Cumascaigh c.t. has 1 contact.
Pre-requisites for using the OIC SurveyMonkey adapter
- A SurveyMonkey Account.
- A quick perusal of the adapter docs here
Essentially it the same old story, sign in to developer.surveymonkey.com and get the required keys.
Note: on the Settings tab I need to set the redirect url -
https://{OIC_HOST}:{OIC_SSL_PORT}/icsapis/agent/oauth/callback
Now I can create the OIC SurveyMonkey connection -
Step 1 is to upload the SurveyMonkey certificate
Note: only the Invoke role is supported.
Click Provide Consent
Alles gut!
I now create a scheduled integration to retrieve the Contact Lists/Contacts from SurveyMonkey -
Firstly I leverage the SurveyMonkey adapter to get the ContactLists -
I then iterate over the results and, for each List,
I invoke SurveyMonkey again, to retrieve the contacts for that list.
I invoke SurveyMonkey again, to retrieve the contacts for that list.
The mapping to Get contacts in list is as follows -
I then log some data to make sure this is working.
So now to my test results -
Looks good!
Now to syncing this up with Netsuite -
Now my logic here is very simple -
ContactList Name = CompanyName in Netsuite
Check if Customer already exists -
If Yes - check if contact already exists, if not - create contact.
If No - create customer and contact(s)
So let's look at the implementation in OIC
Firstly, a caveat - the following does not include error handling - which, naturally, is a must for such.
There is a separate blog post on Netsuite error handling available.
Check if Customer already exists -
Netsuite connection invoke -
Mapping is as follows -
operator is set to "is"
Next step - validate the result of the Search -
I just check the value of totalRecords returned by the search.
If customer not found, I create a new customer in Netsuite -
I just map the ContactList name to Netsuite CompanyName.
I store the existing customer/ newly created customer internal id in an instance variable.
Now to the Contact processing, essentially the same modus operandi -
use search to check for existence.
Then use the integration variable containing the customer internalID, when creating the contact.
Create Contact Mapping is as follows -
I create a new Netsuite customer for one of my 2 contact lists -
I activate and test -
Here my 2 SurveyMonkey contacts have been added to the existing Netsuite customer -
Commiskey Inc
A new customer has been created in Netsuite - along with 1 contact
go raibh maith agaibh go leir agus deireadh seachtaine iontach a bheith agaibh!
No comments:
Post a Comment