You could reduce that list of if statements and th...
# suitescript
n
You could reduce that list of if statements and the number of variables too. something like this.
Copy code
var Sourcetran = (fieldname === 'landedcostsourcetran2' || fieldname === 'landedcostsourcetran3' || fieldname === 'landedcostsourcetran12' || fieldname === 'landedcostsourcetran13' || fieldname === 'landedcostsourcetran19' || fieldname === 'landedcostsourcetran20')?objRecord.getValue({fieldId: fieldname})||'';
(Sourcetran !== '')?BillEdit(Sourcetran):'';
or neater still create an event router:
Copy code
var rec = context.currentRecord;
                var eventRouter = {"entity": handleVendor};
                if (typeof eventRouter[context.fieldId] !== "function") {
                    return
                }
                // trigger the function
                eventRouter[context.fieldId](context);

                function handleVendor(context) {
                //     functionality in here
                }
(all credit to @erictgrubaugh, something I stumbled across that he talks about in videos)