amy
09/28/2022, 3:34 PMbattk
09/28/2022, 4:18 PMamy
09/28/2022, 4:35 PMfunction validateLineExpenseEntry_classifications(type, name){
if(nlapiGetRecordType() == "expensereport"){
if(type == "expense"){
var customer = nlapiGetCurrentLineItemValue("expense", "customer");
if(customer){
var filters = [];
//see if there is a custom linked project fields record where comments are required. we're using a custom record because not many people will have permission to view projects directly and client side code runs in the context of the users role
filters.push(new nlobjSearchFilter("custrecord_linked_project", null, "anyof", customer));
var columns = [];
columns.push(new nlobjSearchColumn("custrecord_class"));
columns.push(new nlobjSearchColumn("custrecord_location"));
columns.push(new nlobjSearchColumn("custrecord_department"));
columns.push(new nlobjSearchColumn("custrecord_type"));
var results = nlapiSearchRecord("customrecord_public_fields", null, filters, columns);
if(results){
var projClass = results[0].getValue("custrecord_class");
var projLoc = results[0].getValue("custrecord_location");
var projDepartment = results[0].getValue("custrecord_department");
if(projClass){
nlapiSetCurrentLineItemValue("expense", "class", projClass, false, true);
}
if(projLoc){
nlapiSetCurrentLineItemValue("expense", "location", projLoc, false, true);
}
if(projDepartment){
nlapiSetCurrentLineItemValue("expense", "department", projDepartment, false, true);
}
}
}
}
}
return true;
}
amy
09/28/2022, 4:35 PMbattk
09/28/2022, 4:51 PMcreece
09/28/2022, 5:33 PMamy
09/28/2022, 5:41 PMcreece
09/28/2022, 6:06 PM