Contact Free trial Login

NetSuite Connector Troubleshooting - Mule 4

Connectivity Test Failure During Application Startup

If a connectivity test fails during application startup and you see the following statement in the stack trace, configure a reconnection strategy for the connector:

Caused by: java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:998) ~[?:1.8.0_221]

To configure a reconnection strategy for the connector in Anypoint Studio (Studio), add these lines to the Configure XML tab in the connector properties window:

<reconnection failsDeployment="true">
	<reconnect count="2" frequency="5" />
</reconnection>

For example, the configuration XML for the connector might look like this after you add the reconnection strategy:

<netsuite:config name="NetSuite_Config" doc:name="NetSuite Config" doc:id="8a4f73c2-e5e1-4f5d-8978-980069828ff0" >
	<netsuite:login-authentication-connection email="${netsuite.email}" password="${netsuite.password}" account="${netsuite.account}" roleId="${netsuite.roleId}" applicationId="${netsuite.applicationId}" readTimeout="60000" connectionTimeout="60000">
		<reconnection failsDeployment="true">
			<reconnect count="2" frequency="5" />
		</reconnection>
	</netsuite:login-authentication-connection>

In Studio, you can also use the Advanced tab in the connector properties window to configure a reconnection strategy. To do so, complete the following fields:

Field Value

Reconnection strategy

Standard

Frequency (ms)

5

Reconnection Attempts

2

No Logging of Log Requests and Responses

To log requests and responses when using the connector, add this XML statement to the Log4j configuration file:

<AsyncLogger
  name="org.mule.module.netsuite.extension.internal.connection.HttpWithCookieMessageDispatcher"
  level="DEBUG"/>
<Root level="debug">
    <AppenderRef ref="Console" />
</Root>

Permissions Error When Fetching Metadata

To avoid receiving a permissions error when fetching metadata, enable the Control SuiteScript and Workflow Triggers in Web Services Request option in NetSuite for the role used in the connector configuration.

Inability to Search for Certain Types of Objects

There is a limitation in NetSuite’s SuiteTalk API, that prevents you from searching for certain types of objects, such as Sales Order objects. Because of this limitation, you can’t use the NetSuite Connector Search operation to locate these objects.

To perform a search for Sales Order objects and other unsupported objects, you can do either of the following:

  • Develop a SuiteScript, deploy it as a RESTlet, and call it from the connector.

  • Create a saved search and call it from the connector.

Unable to Add a Record With the ITEM_FULLFILMENT Type

Symptom

When you try to add a record with the ITEM_FULLFILMENT type, you get this error:

********************************************************************************
Message               : org.mule.module.netsuite.extension.api.ItemFulfillmentShipStatus cannot be cast to java.lang.String
Element               : item-fulfillment-bug-demoFlow/processors/3 @ item-fulfillment-bug-demo_(1):item-fulfillment-bug-demo.xml:67 (Add record)
Element DSL           : <netsuite:add-record doc:name="Add record" doc:id="<doc-id>" config-ref="NetSuite_Config" recordType="ITEM_FULFILLMENT"></netsuite:add-record>
Error type            : NETSUITE:UNKNOWN
FlowStack             : at item-fulfillment-bug-demoFlow(item-fulfillment-bug-demoFlow/processors/3 @ item-fulfillment-bug-demo_(1):item-fulfillment-bug-demo.xml:67 (Add record))

  (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

Solution

You can’t use the word package as an attribute inside the entity package list.

Use the following code as a template for your flow:

<ee:transform doc:name="Transform Message" doc:id="<doc-id>" >
                <ee:message >
                    <ee:set-payload ><![CDATA[%dw 2.0
                    output application/java
                    ---
                    {
                        createdFrom: {
                            internalId: 1560,
                        },
                        itemList: {
                            item: payload.itemList.item map (item , indexOfItem) -> {
                                    orderLine: item.orderLine,
                                    itemIsFulfilled: true,
                                    quantity: 1
                            }
                        },
                        packageList: {
                            packageCollection: [{
                                packageTrackingNumber: "9400110200GGTTT",
                                packageWeight: 99.000,
                                packageDescr: "Description"
                            }]
                        },
                        shipMethod: {
                            internalId: 528
                        },
                        shipStatus: 'SHIPPED'
                    }]]></ee:set-payload>
                </ee:message>
            </ee:transform>
            <netsuite:add-record doc:name="Add record"
                                 doc:id="65c72d9b-0419-4c1d-9a3a-2ba8eba59328" config-ref="requestBasedConfig"
                                 recordType="ITEM_FULFILLMENT" />

You can use this sample flow if you need one:

 <netsuite:initialize doc:name="Initialize" doc:id="<doc-id>" config-ref="requestBasedConfig">
                <netsuite:record-to-initialize ><![CDATA[#[%dw 2.0
			output application/java
			---
			{
				reference: {
					internalId: 1560,
						"type": 'SALES_ORDER'
				},
				"type": 'ITEM_FULFILLMENT'
			}]]]></netsuite:record-to-initialize>
            </netsuite:initialize>
            <ee:transform doc:name="Transform Message" doc:id="<doc-id>" >
                <ee:message >
                    <ee:set-payload ><![CDATA[%dw 2.0
                    output application/java
                    ---
                    {
                        createdFrom: {
                            internalId: 1560,
                        },
                        itemList: {
                            item: payload.itemList.item map (item , indexOfItem) -> {
                                    orderLine: item.orderLine,
                                    itemIsFulfilled: true,
                                    quantity: 1
                            }
                        },
                        packageList: {
                            packageCollection: [{
                                packageTrackingNumber: "9400110200GGTTT",
                                packageWeight: 99.000,
                                packageDescr: "Description"
                            }]
                        },
                        shipMethod: {
                            internalId: 528
                        },
                        shipStatus: 'SHIPPED'
                    }]]></ee:set-payload>
                </ee:message>
            </ee:transform>
            <netsuite:add-record doc:name="Add record"
                                 doc:id="<doc-id>"
                                 recordType="ITEM_FULFILLMENT" />