Monday, December 2, 2024

#1048 - OIC Integration Basics Lab 14 OIC Mapper

Mapping is one of the core activities you will be doing, when developing integrations. Syncing data between App A and App B will involve mapping fields from App A to App B. This mapping could be very simple or very complex, depending on your use case and the apps involved. The OIC Mapper works on different levels, this allows us to implement the most simple or most complex of mappings very easily. Let's now look at the different levels. 

Level 1 - simple source to target mapping 

Here you simply drag and drop a source field to a target field. 

The following possible sources are available -

  • For app or event driven integrations, the initial request payload or event payload. Think of an app driven integration to create a new customer in Netsuite. The integration has a REST trigger, so the request payload will be available as a source.
  • Integration Metadata
























  • Request and response payloads from any invokes performed by the integration e.g. the response payload from Netsuite on customer creation - 



































  • Variables, global variables, integration properties and tracking fields - 














Level 2 - using Functions 

All of the functions available are fully documented with examples - 






















So let's look at them - 























Advanced - I've highlighted some that are often used in file processing. generate-guid is also used to generate unique identifiers. There are ,of course, salient use cases for all of these functions.






















Boolean, Conversion and Date are self explanatory, at least I hope so!

Integration Cloud - getFlowId returns the instance id of the integration. This can be useful for a number of reasons, including compliance. isReplayed - tells us if this integration flow is a re-run.
lookupValue we've already met in the Lookups post.























String functions are often used, a typical example would be concat -  where you want to concatenate 2 or more source fields and then map the result to a target field. 

User Defined - includes functions that have been imported into the project e.g.

Operators

XSLT Constructors

























choose, when, otherwise
is very useful for conditional mapping. For example, only map the approver field when the incoming order is greater than $10k.

for-each (iterate over a specified sequence of fields) and for-each-group (select fields or nodes and organize into groups) 



















copy-of
is very useful for deep copying, i.e. your source and target structures are the same so just apply this at the node level, to avoid having to map all the individual fields.

Again, the documentation within the mapper is excellent, but you can always google to get more details. 

Developer View

The subtle difference here is I see the underlying field names, when I click Developer, otherwise, I see more user friendly element/field names.

Using Search

Some of these SaaS business objects can be very complex with many fields. Take my Netsuite customer object here. I need to map the Address fields, but where are they?














Filter Options

This is also very useful to de-clutter your mapping UI.

Code View

Here you see the underlying xslt which will be used at runtime to do the actual mapping.

You can also edit this, once you know what you're doing - 

Testing the Mapping

Mapping is the core of your integration flows, so the earlier you can test this, the better.

In the tester, you can generate inputs - 

You can, of course, edit what has been generated. 

Then click Execute to test - 















 





 



























 








Sunday, December 1, 2024

#1047 - OIC Integration Basics Lab 13 OIC Lookups

 

Lookups are domain value maps, which make it easy for us to map values between different applications. These values could be essentially for the same thing, e.g. a country code. In app1, the country of Ireland is referred to as IE (alpha 2 code), while in app2, it is referred to as IRL (alpha 3 code).


You can also change the column titles to reflect the target app - 

Now to using this in an integration, here's one, where I create a new customer in Netsuite - 

This starts the lookup wizard - 

First step is to select the source column, in my case, App1 - 

Then the Target - 

I could add a default value, but, in this case, I leave it empty - 


Note the srcValuePlaceholder - this I need to replace with the country field from the request payload -




I map the other fields accordingly - 

I activate and run the integration -

So "IE" is not the right code for Netsuite, so I look at the Netsuite docs - 

So I change the lookup accordingly - 

I run the integration again, and get a new error - 
Netsuite requires a subsidiary id, i.e. under which subsidiary do I want to create the customer. 

The subsidiary value, in my case 1, is also a good candidate for a lookup -

I use this in the mapper - 


srcValuePlaceHolder needs to be replaced by 'subsidiaryID'.

I re-run the integration - 

Note the Netsuite internal id for the newly created customer.

Finally, lookup support in the OIC3 Factory api

Here we have CRUD support for lookups, as well as the ability to import.

Import is very useful when the lookup values are coming from an external source e.g. my products csv file - 

Line 1 A - DVM mandatory
Line 1 B - Lookup name
Line 1 C - Lookup description
Line 1 D - keyword

Line 2 - Lookup columns
Lines 3 to 6 - Lookup values

Note the 204 response.

This Lookup has been added to OIC, but not to a specific project. To do that, I need to invoke - /ic/api/integration/v1/projects/{projectId}/lookups/archive