Overriding Script not working

remyaraghu
Tera Contributor

Hello Community,

 

I wanted to auto approve order conditionally, set sn_ind_tmt_orm.enable.auto.approval default true.

 

Added my conditions in "canAutoApproveBasedOnOrder" function in OrderUtilOOB  override scripts added in OrderUtil script but the added script not taking its always auto approve order.

 

var OrderUtil = Class.create();
OrderUtil.prototype = Object.extendsObject(OrderUtilOOB, {
    // Define overriding functions here
    canAutoApproveBasedOnOrder: function(orderGr) {
 
if(!orderGr || !orderGr.sys_id){
          return false;
        }
        if(orderGr.orderCurrency == 'USD'){
            return true;
        }
        return true; // default to not auto-approving
  },
    type: 'OrderUtil'
})
 

Can you please say what is wrong here I am doing please.

0 REPLIES 0