Hi everyone, I’m trying to set a custom segment (D...
# suitecommerce
n
Hi everyone, I’m trying to set a custom segment (Division) on the Sales Order created through SCA. The field is
cseg_ei1_division
, which appears on the Sales Order, and our requirement is to preselect the Division from the available segment values when the customer places an order through SCA. I’m currently trying to use:
Copy code
cart.setTransactionBodyField({
    fieldId: 'cseg_ei1_division',
    type: 'string',
    value: '9'
});
I’ve already added the field under Commerce → Websites → Configuration → Advanced → Custom Fields → Sales Order, but I’m getting:
TypeError: Cannot read properties of undefined (reading 'cseg_ei1_division')
From what I’ve found so far,
setTransactionBodyField()
seems to be documented/supported primarily for standard custom transaction body fields (
custbody_*
), and I haven’t found a clear example of it being used with a custom segment (
cseg_*
). Has anyone successfully used
setTransactionBodyField()
with a custom segment / Division field in SCA? If not, is there a recommended workaround or another SCA/checkout approach for setting a custom segment value on the Sales Order before submission? Any guidance would be appreciated. Thanks!
e
If you really need this before submission I would go for scriptable cart, otherwise I would use a user event script on after submit.
this 1
👍 1