FooLman
FooLman

Reputation: 457

Mule ESB - NetSuite Upsert with Custom Fields

I'm trying to upsert Journal Lines with Mule ESB, using the NetSuite connector. In our setup there are a lot of custom fields, some are required. There is a Journal Entry with several lines, which has to be posted to NS, using an upsert operation, but I'm stuck with custom fields.

Here is what I tried so far:

  1. created a JournalEntry object, and passed it to the NetSuite component. Failed, as it is not a map, and there is no Upsert Object operation.
  2. passed this object to DataMapper. The CustomFields are not mapped, also the resulting map is an unreadable mess.
  3. created a map of the fields, where custom fields were a maps inside the map, got JAXB errors.

Unfortunately the documentation is not mentioning custom fields at all. Anyone can tell me a working approach?

Upvotes: 0

Views: 995

Answers (1)

FooLman
FooLman

Reputation: 457

...spoke a moment too soon. I found the solution.

The structure of the "customField" entry has to be List<Map<String,Object>> where Object is either a CustomFieldRef or anything else.

In case of CustomFieldRef the key of the map is ignored, and the value is copied over unchanged to the message.

In case of other class the key of the map has to be the following format: FieldTypeClass__fieldname (where __ is the separator.) Thus SelectCustomFieldRef__custbody_source_system results in a SelectCustomFieldRef object with scriptId set to custbody_source_system.

Example:

%dw 1.0
%output application/java
---
{
    internalId : 123456,
    tranId : 'TR-2016-01',
    customFieldList : {
        customField : [
        StringCustomFieldRef__custbody_payment_url : 'http://www.example.com'
        ]       
    }
}

Upvotes: 1

Related Questions