When we use the intent creation of the stripe payment, we need to store the intent id in the sales order record during the sales order creation on the website.
So we used ModelsInit.order.setCustomFieldValues(); function for updating the custom field in the sales order.
var IntentID = JJ_stripeLibrary.StripeIntent(confirmation, fieldValue.value, confirmation.summary.total, confirmation.tranid)
nlapiLogExecution("ERROR", "custom1", JSON.stringify(IntentID));
var ConfirmID = JJ_stripeLibrary.StripeConfirmpayment(IntentID)
nlapiLogExecution("ERROR", "ConfirmID", JSON.stringify(ConfirmID));
var custom = {
'custbody_stripe_intent': IntentID
};
ModelsInit.order.setCustomFieldValues(custom);
nlapiLogExecution("ERROR", "custom", JSON.stringify(custom));
The two scenarios is added below
Case 1.
var string1 = ‘value1’;
var string2 = ‘value2’;
var fields = { custbody_field1: string1 + ‘|’ + string2 };
ModelsInit.order.setCustomFieldValues(fields);
Expected: No error
Actual: Error, with the unrelated message “ERR_WS_SET_TERMSCONDITIONS”
---
Case 2. (with toString() function)
var string1 = ‘value1’;
var string2 = ‘value2’;
var fields = { custbody_field1: (string1 + ‘|’ + string2).toString() };
ModelsInit.order.setCustomFieldValues(fields);