Nick
02/01/2021, 4:29 PMbattk
02/01/2021, 4:50 PMinternal id
battk
02/01/2021, 4:52 PMaddress internal id
is what is shown in the ui on the customer in the id column, and is what is used as a select value in the billaddresslist
fieldbattk
02/01/2021, 4:52 PMbattk
02/01/2021, 4:53 PMinternal id
is the actual internal id used for normal things like searching by internal id, or loading the address subrecordNick
02/01/2021, 4:53 PMbattk
02/01/2021, 4:53 PMbattk
02/01/2021, 4:54 PMbillingaddress
subrecord and getting its id fieldbattk
02/01/2021, 4:55 PMNick
02/01/2021, 4:55 PMbattk
02/01/2021, 4:56 PMbattk
02/01/2021, 4:56 PMNick
02/01/2021, 4:57 PMbattk
02/01/2021, 4:57 PMNick
02/01/2021, 4:58 PMNick
02/01/2021, 4:58 PMNick
02/01/2021, 4:58 PMbattk
02/01/2021, 4:59 PMbattk
02/01/2021, 4:59 PMbattk
02/01/2021, 4:59 PMbattk
02/01/2021, 5:01 PMNick
02/01/2021, 5:04 PMvar invoiceSearchObj = search.create({
type: "invoice",
filters:
[
["type","anyof","CustInvc"],
"AND",
["internalid","anyof","782532"],
"AND",
["mainline","is","T"]
],
columns:
[
search.createColumn({
name: "internalid",
join: "CUSTBODY_KES_BILLTO",
label: "Internal ID"
}),
search.createColumn({name: "custbody_kes_billto", label: "Bill To"}),
search.createColumn({
name: "addressinternalid",
join: "CUSTBODY_KES_BILLTO",
label: "Address Internal ID"
}),
search.createColumn({
name: "internalid",
join: "billingAddress",
label: "Internal ID"
})
]
});
var searchResultCount = invoiceSearchObj.runPaged().count;
log.debug("invoiceSearchObj result count",searchResultCount);
invoiceSearchObj.run().each(function(result){
// .run().each has a limit of 4,000 results
return true;
});
Nick
02/01/2021, 5:05 PMbattk
02/01/2021, 5:05 PMbattk
02/01/2021, 5:06 PMbattk
02/01/2021, 5:06 PMbattk
02/01/2021, 5:07 PMsearch.createColumn({
name: "internalid",
join: "billingAddress",
label: "Internal ID"
})
is the internal idNick
02/01/2021, 5:07 PMbattk
02/01/2021, 5:08 PMbattk
02/01/2021, 5:09 PMaddressinternalid
is only a valid column on an entity searchbattk
02/01/2021, 5:12 PMbattk
02/01/2021, 5:14 PMbattk
02/01/2021, 5:14 PMNick
02/01/2021, 5:15 PMvar invCust = record.load({'type': 'customer', 'id': cust, 'isDynamic': false});
var addrSublist = 'addressbook';
var linecount = invCust.getLineCount({'sublistId':addrSublist});
var invDelivery = false;
var coverLetter = false;
var invEmail = '';
for(var line = 0; line < linecount; line++)
{
var defaultBilling = invCust.getSublistValue({'sublistId': addrSublist, 'fieldId':'defaultbilling', 'line': line});
if (defaultBilling == true) {
var addressSubrecord = invCust.getSublistSubrecord({
sublistId: addrSublist,
fieldId: 'addressbookaddress',
line: line
});
// Set all required values here.
invDelivery = addressSubrecord.getValue({fieldId: 'custrecord_kes_cfaexcelinvoicedelivery'});
coverLetter = addressSubrecord.getValue({fieldId: 'custrecord_kes_coverletterreqd'});
invEmail = addressSubrecord.getValue({fieldId: 'custrecord_kes_invoiceemail'});
}
}
Nick
02/01/2021, 5:16 PMbattk
02/01/2021, 5:17 PMbattk
02/01/2021, 5:17 PMbattk
02/01/2021, 5:18 PMNick
02/01/2021, 5:18 PMbattk
02/01/2021, 5:18 PM