Hello! I am trying to design a direct integration ...
# suitescript
j
Hello! I am trying to design a direct integration inbound to NS through RESTlet. We're dealing with 2 external systems and looking into the best possible way to setup the mapping table. Initial thought is setting up a custom record to handle the mapping table, another option is creating a mapping file. What's the best practice in here to make it easier to maintain in the future? Thanks! 🙂
k
Roughly how many data fields are you dealing with? Are you thinking about building a mapping table because you anticipate changes that you want a business user (non-developer) to be able to change? There are so many variables, it's a little hard to know without more context. If you have NS developers - and always will - and only a few fields (20 or less), you can just do the mapping in the RESTlet code. If you need to make a change, it's as simple as opening the script and making the change. The mapping table might actually introduce more complexity. Any additional context you can provide? I integrate many systems with API's, so I've seen the pros/cons and have tried many different methodologies.
p
I created a custom record that will store a JSON object. This JSON object will then map the request from outside to the NS record. The mapping is done by a module, if you need to add new mapping, just update the JSON. You don’t need to update the script. The mapping can support a simple a “if then else” without updating the script, it can also handle date/string manipulations. The module can also generate a request (with the aid of the mapping) that will be use to consume an API outside of NS.
k
Is it working? If so, that sounds like it will work perfect. That sounds like a great solution if you think the data object will change over time (which of course, they often do) and you want a non-developer to be able to make updates.
p
We are integrating NS with 3+ other systems using that custom module I built. It's not only for updating existing mappings but also for rapid deployment. This is a sample mapping.
Copy code
{
  "entity": {
    "value": "customernsid"
  },
  "subsidiary": {
    "value": "properties.nssubsidiary"
  },
  "custentity_field": {
    "text": "fields.customfield_10230[0].value"
  },
  "currency": {
    "value": "properties.deal_currency_code",
    "mapping": {
      "USD": 1,
      "GBP": 2
    }
  },
  "probability": 25,
  "custbody_hubspot_hs_lastmodifieddate": {
    "date": "properties.hs_lastmodifieddate",
    "format": "epoch"
  }
}
Hoping to replace this JSON with a drag-and-drop mapping like the reactflow
k
Nice