Trouble Creating Credit Memos in NetSuite

Hi All,

As the title suggests, I'm encountering an unexplainable error during the mapping stage on the destination step (NetSuite). Below is a screenshot of the mapping, and the field I'm struggling with is the 'Customer (InternalId) -> NS_CustomerInfo[0].internalid'.

When I hit "preview" in the mapping window, I see the field entity (Customer (InternalId) mapped to the corresponding customer internal ID.

Sample mapping preview:
{
"nlobjFieldIds": {
"otherrefnum": "#2525",
"entity": 7630839,
"memo": "Lost Package Refund",
"cseg_mhi_sc": 1,
"location": 1,
"department": 109,
"custbody_tw_shopify_refund_id": "gid://shopify/Refund/1058756395200"
},
"nlobjSublistIds": {
"item": {
"lines": [
{
"item": 44211,
"quantity": "1",
"rate": "10.0"
}
]
}
}
}

When I actually run the integration live (not in test mode), from the requests page I see the entity field has been changed to 0 instead of the internal ID displayed in the preview window.

Faulty request: you can see that "entity" has resolved to 0

importing record {"index":0,"retryCount":0}
{"nlobjRecordType":"creditmemo","nlobjFieldIds":{"otherrefnum":"#2481","entity":0,"memo":"Lost Package Refund","cseg_mhi_sc":1,"location":1,"department":109,"custbody_tw_shopify_refund_id":"gid://shopify/Refund/1058895298752","internalid":""},"nlobjSublistIds":{"item":[{"item":44211,"quantity":1,"rate":"12.0"}]}}
nlapi calls registered for $R:
r = NRecord.create({"type":"creditmemo","defaultValues":{}});
r.setValue({"fieldId":"otherrefnum","value":"#2481"});
r.setValue({"fieldId":"entity","value":0});
r.setValue({"fieldId":"memo","value":"Lost Package Refund"});
r.setValue({"fieldId":"cseg_mhi_sc","value":1});
r.setValue({"fieldId":"location","value":1});
r.setValue({"fieldId":"department","value":109});
r.setValue({"fieldId":"custbody_tw_shopify_refund_id","value":"gid://shopify/Refund/1058895298752"});
r.insertLine({"sublistId":"item","line":0});
r.setSublistValue({"sublistId":"item","fieldId":"item","line":0,"value":44211});
r.setSublistValue({"sublistId":"item","fieldId":"quantity","line":0,"value":1});
r.setSublistValue({"sublistId":"item","fieldId":"rate","line":0,"value":"12.0"});
r.save({"enableSourcing":false,"ignoreMandatoryFields":false});

Does anyone have any insight into what the cause could be? If I hard-code a customer's internal ID instead of referencing NS_CustomerInfo[0].internalid, the flow will work just fine, and the correct credit memos will be created in NetSuite. Once I switch over to NS_CustomerInfo[0].internalid, it breaks the whole thing.

It seems the record used in the preview is different from the one that failed in the live run:

Preview record: Reference #2525
Live debug logs: Reference #2481

The preview confirms that the mapping expression works when an internal ID is available. However, it does not confirm that every live record has an internal ID at NS_CustomerInfo[0].internalid.

Please preview or inspect the lookup result using the exact failed record, #2481.