simple question: I would like to set custom body f...
# suitecommerce
l
simple question: I would like to set custom body field by extending LiveOrderModel, here is what I tried, but didn't worked, could someone help me on this?
Copy code
_.extend(LiveOrderModel.prototype, {
        initialize: _.wrap(LiveOrderModel.prototype.initialize, function (fn) {
            fn.apply(this, _.toArray(arguments).slice(1));
            this.on('after:sync', function () {
                 this.set('custbody_test_field', 'T'); 
            }.bind(this));
        })
    });
c
1. Is your initialize extension running? 2. Assuming #1, is your event firing? 3. Assuming #1 & 2, is your
custbody_test_field
actually showing up on the back-end?
s
4. Is your transaction body field marked for "Display in webstore"? 5. Have you configured the transaction body field in the config record? Config Record -> Advanced Tab -> Custom Fields?
💯 1
l
Wow, Thanks for the reply @Chris and @Sebastian Alexis Gonzalez 1. Yes 2. Yes (When event fire ups it always set that field value as 'F') not matter , though the code comes to 'this.set('custbody_test_field', 'T');' this line 3. No 4. Yes 5. Yes
c
@Lucas Check the
put
request going to the back-end by looking at LiveOrder.Model.ss in the network panel and see if your field is included in the payload.
l
Sure
Will check
is there anything I need to check? @Chris
c
When you view the payload in the LiveOrder.Service.ss
put
call, your custom attribute
custbody_test_field
should be in there somewhere.