node-suitetalk icon indicating copy to clipboard operation
node-suitetalk copied to clipboard

Lists do not support multiple list items

Open l20DfX35JnKBfRn opened this issue 4 years ago • 2 comments

You can run the sales order example with console.log(service.config.client.lastRequest) and you will see something like this:

<soap:Body>
		<platformMsgs:add
			xmlns:platformMsgs="urn:messages_2019_2.platform.webservices.netsuite.com"
			xmlns="urn:messages_2019_2.platform.webservices.netsuite.com">
			<tranSales:record externalId="store-10001" xsi:type="tranSales:SalesOrder">
				<tranSales:entity internalId="345678" type="customer" xsi:type="platformCore:RecordRef"></tranSales:entity>
				<tranSales:orderStatus>_pendingFulfillment</tranSales:orderStatus>
				<tranSales:location internalId="999" xsi:type="platformCore:RecordRef"></tranSales:location>
				<tranSales:shippingCost>0</tranSales:shippingCost>
				<tranSales:isTaxable>false</tranSales:isTaxable>
				<tranSales:itemList replaceAll="true" xsi:type="tranSales:SalesOrderItemList">
					<tranSales:item xsi:type="tranSales:SalesOrderItem">
						<tranSales:item internalId="88888" type="account" xsi:type="platformCore:RecordRef"></tranSales:item>
						<tranSales:quantity>2</tranSales:quantity>
						<tranSales:price internalId="-1" type="priceLevel" xsi:type="platformCore:RecordRef"></tranSales:price>
						<tranSales:amount>30</tranSales:amount>
						<tranSales:rate>15</tranSales:rate>
						<tranSales:isTaxable>false</tranSales:isTaxable>
					</tranSales:item>
				</tranSales:itemList>
				<platformCore:nullFieldList xsi:type="platformCore:NullField"
					xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com">
					<platformCore:name>salesRep</platformCore:name>
				</platformCore:nullFieldList>
				<tranSales:customFieldList
					xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com">
					<platformCore:customField xsi:type="platformCore:StringCustomFieldRef" scriptId="custbody_number" >
						<platformCore:value>321321321</platformCore:value>
					</platformCore:customField>
				</tranSales:customFieldList>
			</tranSales:record>
		</platformMsgs:add>
	</soap:Body>

The list had two items, but only shows one in the xml.

Looking at the List class, I can see why is happening. https://github.com/felipechang/node-suitetalk/blob/master/app/record/lists/common/list.js#L46

l20DfX35JnKBfRn avatar Dec 30 '21 13:12 l20DfX35JnKBfRn

To those with the same issue, I have added support on my fork (not thoroughly tested but works for sales orders)

l20DfX35JnKBfRn avatar Dec 30 '21 15:12 l20DfX35JnKBfRn

It has come to my attention that #19 PR fixes this issue.

l20DfX35JnKBfRn avatar Jan 12 '22 10:01 l20DfX35JnKBfRn