erictgrubaugh
07/01/2020, 10:56 PMbeforeSubmit
isn't aware of Copy events; it sees a copied record the same as a Create. Is there some other customization running later on beforeSubmit
, on afterSubmit
, or on beforeLoad
that would be modifying the value of this field in question as well?Tyson Eby
07/01/2020, 11:01 PMTyson Eby
07/01/2020, 11:09 PMdefine(['N/record', 'N/format'],
function(NS_record, format) {
function beforeSubmit(context) {
var stMethodName = 'beforeSubmit';
try {
var recCurrent = context.newRecord;
var useCustShip = recCurrent.getValue('custbody_use_cust_ship');
if(((context.type == context.UserEventType.EDIT) || (context.type == context.UserEventType.CREATE)) && useCustShip != true){
recCurrent.setValue('custbody_customer_ship_billing_zip', ''),
recCurrent.setValue('custbody_customer_ship_acct', ''),
recCurrent.setValue('custbody_customer_ship_billing_country', ''),
recCurrent.setValue('custbody_customer_ship_carrier', '')
}
} catch (error) {
log.error(stMethodName, error.message);
} finally {
log.debug(stMethodName, '* * * E n d * * * ');
}
}
return {
beforeSubmit: beforeSubmit
};
});
Sandii
07/01/2020, 11:24 PMTyson Eby
07/01/2020, 11:30 PMcontext.type == context.UserEventType.COPY
in the if statement.Tyson Eby
07/01/2020, 11:30 PM