Friday, July 31, 2020

#788 OIC 4 Netsuite - Implementing a Generic Error Handler

Firstly a big thank you to my colleagues Kishore, Subhani, Devi and Praveen for their support in respect of Netsuite integrations and for providing me with the basis for this blog post.

Many things in life are a necessary evil - error handling in OIC is not one of them. Granted it is extra work, but if you invest the time up front this will greatly accelerate your integration development.

Generic Error Handler 




















In the above example we have 3 options - only one has been implemented, but you can easily extrapolate from this.

Let's start with the trigger definition -

























The fields are self-explanatory - Fault Details will be returned by Netsuite.

Assign Notification Type -













This variable is then checked in the SWITCH Action -












The Notification Action -






















I think this is relatively straightforward, now to leveraging the error handler -

Invoking Generic Error Handler from an Integration


I will now enable error handling on the SurveyMonkey to Netsuite integration, discussed in the previous post.

Here is the starting position - with no error handling implemented -










Granted, this is not the complete integration, but, from what you can see, only the happy path has been implemented.

Now I put the core of the actions - focusing on those related to Netsuite - into a Scope.















Scopes are there for keeping related tasks together, scopes also come with their own Fault Handler.

Now to processing possible Netsuite errors -

Here is the current version of the Netsuite CustomerCheck logic -















I will add a new SWITCH action directly after Check4Customer to check for Netsuite errors -

The data structure returned by Netsuite is as follows -

I check the value of the isSuccess field -













I then select the Throw New Fault Action , if a Netsuite error has occurred.
I configure as follows -

Code -


Reason -













Details -





























I now add a skip condition to skip the case where a customer has not been found.
Netsuite returns the following - "INVALID_KEY_OR_REF" - in such cases.


















So now that the fault has been thrown, let's catch it -

This is where the SCOPE fault handler comes into play.











So here I call the GenericErrorHandler




















I map the fields accordingly

























instanceID is set to -














IntgCode_Version is set to -

a concatenation of identifier and version




notificationType is set to "EMAIL"

fault_code etc. set as follows -












faultDateTime is set to current time.

Ok, so what about the next Netsuite activity?










same modus operandi -

I set the Throw New Fault variables using -



























agus ar uile...

No comments: