How to use the correctly, Where to populate the fi...
# suitecommerce
l
How to use the correctly, Where to populate the field?
Copy code
var cart = container.getComponent('Cart');
			var data = {
				fieldId: "custbody_test_field",
				type: "string",
				value: "C123456"
			}

			cart.setTransactionBodyField(data).then(function() {
				console.log(data.fieldId + ' was set to ' + data.value);
			}).fail(function(error) {
				console.log('setTransactionBodyField failed.');
			});
Any of the following circumstances will cause this method to fail and return an error: • If there are no transaction body fields on the page. • If the specified transaction body field is not on the page. • If the value of
value
does not match the specified
type
in the TransactionBodyFieldData object. • If the value of
type
in the TransactionBodyFieldData object does not match the field type in NetSuite.
s
Try it in the checkout. If it works then you've stumbled upon issue 659128
l
Hello @Steve Goldberg, good day! Is there an existing issue with setTransactionBodyField method? We also stumbled upon an issue on setting a custom Transaction Body Field in Checkout using this method. The customization was made last 2023 and it suddenly stopped working recently. The custom field is configured properly: Displayed in Website, Applied To Sale, Store Value is true. It is also added under Advanced > Custom Fields in SC Configuration. This issue is both occurring on different SCA versions: 2023.2 and 2024.2. Thanks!
s
The only known issue I have for it is that it will fail when used in the shopping application; it should still work in checkout
Feel free to raise a bug
l
Thanks @Steve Goldberg. Will do!