function bolEmailSend(bolFile,currentRecord,ifHash,soHash,newMemo,senderId,ifRecId,poHash) {
try {
var fileObj = file.load({
id: bolFile
});
fileObj.folder = 285343;
fileObj.save();
var line_count = currentRecord.getLineCount({
sublistId: 'item'
});
var wareHouseEmails = [];
for (var j = 0; j < line_count; j++) {
var warehouseIs = currentRecord.getSublistValue({
sublistId: 'item',
fieldId: 'location',
line: j
});
if (warehouseIs == 1 || warehouseIs == 6) {
wareHouseEmails.push('corpdesign-MIA@craneww.com')
} else if (warehouseIs == 12 || warehouseIs == 4) {
wareHouseEmails.push('CorpDesign-DFW@craneww.com')
}
}
var uniqueArray = new Set(wareHouseEmails);
var emailArray = Array.from(uniqueArray);
var bolEmailBody = "You have received a BOL for " + ifHash + " / " + soHash +"/"+ poHash + ", Please print and dispatch on to the shipment!"+'<br/><br/>'+"Warehouse Procedures for Corp Design’s account:"+'<br/><br/>'+"1.Follow the dashboard’s instruction"+'<br/>'+
"2.Prepare orders the day before Shipping Date"+'<br/>'+
"3.Compare"+'<b>' +"Packing Slip"+'</b>'+ "with"+'<b>'+"Pick Ticket"+'</b>'+"to make sure all items are pick the way they are supposed to"+'<br/>'+
"4.Enter pallet dimensions and pallet size in the 1st SO of the MEMO line inside the IF record"+'<br/>'+
"5.UPLOAD pictures of the shipment onto the IF of the 1st SO#"+'<br/>'+
"6.Mark ALL IF as PACKED"+'<br/>'+
"7.Print BOL and ALL Packing Slips and apply to shipment once notification received"+'<br/>'+
"8."+'<b>'+"ONCE CARRIER PICKS UP:"+'</b>'+'<br/>'+' '+"a.Update the Carrier and Pro# on the IF inside the 1st SO#"+'<br/>'+
' '+"b.Update the MEMO in the IF of the 1st SO# by copying the MEMO from the SO#"+'<br/>'+
' '+"c.Mark ALL IF as SHIPPED AFTER they leave the DOCK"+'<br/><br/>'+"Thank you."
var bolEmailSubject;
if (soHash) {
if(poHash){
bolEmailSubject = "Please find the attached BOL for the " + ifHash + "/" + soHash +"/"+ poHash + " " + newMemo + ", shipment has been scheduled for pickup with the carrier."
}else{
bolEmailSubject = "Please find the attached BOL for the " + ifHash + "/" + soHash + " " + newMemo + ", shipment has been scheduled for pickup with the carrier."
}
} else {
if(poHash){
bolEmailSubject = "Please find the attached BOL for the " + ifHash +"/"+ poHash + " " + newMemo + ", shipment has been scheduled for pickup with the carrier."
}
else{
bolEmailSubject = "Please find the attached BOL for the " + ifHash +" " + newMemo + ", shipment has been scheduled for pickup with the carrier."
}
}
//send email to warehouses
email.send({
author: senderId,
recipients: emailArray,
body: bolEmailBody,
subject: bolEmailSubject,
attachments: [fileObj],
relatedRecords: {
transactionId: parseInt(ifRecId)
}
});
record.submitFields({
type: record.Type.ITEM_FULFILLMENT,
id: ifRecId,
values: {
custbody13: true
}
});
}catch (e) {
log.error("error@bolEmailSend",e)
}
}