This article will show how to retain the Handling Tax Code of a bill record created from a Sales order.
1. Create a new user event script. Customization > Scripting > Scripts > New > User Event
2. Enter information needed on the Basic Information:
Name: (name of your script)
Scripts > Script : Upload the sample script Below.
Before Load : beforeLoad
Deployments > Applies to: Invoice
Deployed: Yes
Status: Released
Save
Sample script:
function beforeLoad(type){
var origin = nlapiGetFieldValue('createdfrom');
if (!isNullorEmpty(origin) && type == 'create'){
var rec = nlapiLoadRecord('salesorder', origin);
var hTax = rec.getFieldValue('handlingtaxcode');
var hRate = rec.getFieldValue('handlingtax1rate');
nlapiSetFieldValue('handlingtaxcode',hTax);
nlapiSetFieldValue('handlingtax1rate',hRate);
}
}
function isNullorEmpty(strVal){
return (strVal == null || strVal == '');
}
No comments:
Post a Comment