We are currently importing Salesorder from 3rd party, The Salesorder creation is done fine. We are struggling with the shipping address, we need to create a custom shipping address at each new salesorder.
when we use the following code, only the shipzip is shown in the salesorder, do you see any reason for that?
var shippingDetails = order[k].shipping_address;
log.debug('shipping',shippingDetails);
salesOrder.setValue('shipaddresslist', null);
salesOrder.setValue('shipcountry', shippingDetails.country_iso_code.substring(0,2));
log.debug('shipcountry',
salesOrder.getValue({
fieldId: 'shipcountry'
})
);
salesOrder.setValue('shipisresidential', 'T');
salesOrder.setValue('shipattention', 'Adresse de livraison');
log.debug('shipattention',
salesOrder.getValue({
fieldId: 'shipattention'
})
);
salesOrder.setValue('shipaddressee', shippingDetails.civility +' '+shippingDetails.firstname+' '+shippingDetails.lastname);
log.debug('shipaddressee',
salesOrder.getValue({
fieldId: 'shipaddressee'
})
);
salesOrder.setValue('shipaddrphone', shippingDetails.phone);
salesOrder.setValue('shipaddr1', shippingDetails.street_1);
salesOrder.setValue('shipaddr2', shippingDetails.street_2);
salesOrder.setValue('shipcity', shippingDetails.city);
//salesOrder.setValue('shipstate', 'CA');
salesOrder.setValue('shipzip', shippingDetails.zip_code);
as a workaround we try to use instead the below code, how can we have the carriage return?:
salesOrder.setValue('shipaddress', shippingDetails.civility +' '+shippingDetails.firstname+' '+shippingDetails.lastname +'\n'+shippingDetails.street_1+'\n'+shippingDetails.zip_code+' '+shippingDetails.city);