[Mapper 1.0 - Integration App] How to Lookup for array data type

I am working in the [Magento 2 - NetSuite] Integration App > [Magento Customer to NetSuite Customer Add/Update] flow. This integration app uses Mapper 1.0.

I want to add an import step mapping of a string-array field. I want to add a Lookup for that mapping, doing a Lookup for each string in the array, but I don't see how in this Mapper 1.0 flow. The Lookup only works for a single source-to-destination value, not a string-array - even if I set the "Data type" to "String array".

If I could, I would use a "Dynamic: NetSuite search" Lookup, but I will settle for a "Static: Value to value" Lookup.

Took me a few tries, but this is working for me. I didn't try with dynamic mapping, but this should work for that as well.


1 Like

@tylerlamparter , thank you for your response!
Unfortunately, it doesn't look like this will work. This does work if the destination record field is a sublist field, which is what you are showing. I confirmed this does work myself. But it doesn't work when the destination field is a body field that is multi-select type in Netsuite. I neglected to include that point, which seems to be the unsupported point that I am stuck at.

Unfortunately, I hit a roadblock as well. I was attempting to use each Handlebars with compare blocks, but it seems the compare block will force exit of the else block when something is evaluated to true. I don’t think it does this when it’s a mapping to a sublist, but since you’re going to a body field, we would need this added functionality. We are working on many Handlebars enhancements, so I’ll get this on the list.

Also, since you’re using the IA, the only other solution I can think of would be to create a user event script in NetSuite that runs before submit. In that script, you could have this mapping logic. You could alternatively custom build the whole flow and not use the IA and then use scripts in Celigo.

1 Like

@tylerlamparter , thanks again for the follow-up!
You have arrived at the same conclusion that I have. I did attempt to use a Netsuite user event script to map the values in beforeSubmit context - unfortunately the values on the Record don't make it that far. Looking at debug logs from the Celigo restlet logic, it seems that setFieldTexts is automatically used for the field when the values in question are a string, even when I map them as internalid in Celigo. setFieldTexts only sets values that are valid, and since these aren't, in my beforeSubmit user even the field on newRecord shows empty array.

My best workaround right now is to add a new hidden entity field on Netsuite that I will use to pass the value through. I will pull that value in the user event, map it, and then set to the real field. Not a pleasant workaround.

I'm looking forward to this functionality working in integrator.io! Thanks again!

I read your first paragraph and was thinking "you'll need to map to a hidden custom field", but you got exactly where I was going!

1 Like

@nathanmatthews I'm not sure how many options you have, but can you try this? Thanks to @priyankakoundal's help, this should work. We've also raised a bug for the else compare exiting the loop after the initial compare check.

{{#each tags}}{{#compare this "===" "abc"}}item1{{/compare}}{{#compare this "===" "xyz"}}item2{{/compare}}{{^if @last}},{{/if}}{{/each}}

@tylerlamparter, I have ~70 options to map, so not ideal to put all into handlebars (if it could even handle that long of a string). This is nice to know, though. Thanks @priyankakoundal !

That makes sense why you wouldn't want that in compare handlebars then. We will support lookupCache in handlebars at some point and then in that case you'd probably be able to use it. I think it would work for Mapper 1.0 handlebars and IAs, but will confirm with @priyankakoundal.

1 Like