Kevin Baxter
06/07/2023, 2:40 PMconst beforeSubmit = (scriptContext) => {
var newRecord = scriptContext.newRecord
var oldRecord =scriptContext.oldRecord
var standardRoyalty = newRecord.getValue({
fieldId: 'custrecord_lf_school_std_roy_perc'
});
var headwearRoyalty = newRecord.getValue({
fieldId: 'custrecord_lf_school_hdwr_roy_perc'
})
var schoolName = newRecord.getValue({
fieldId: 'custrecord_lf_school_name'
})
var mysearch = search.create({
type: search.Type.CUSTOMER,
columns: ['entityid', 'companyname', 'custentity_lf_school_list']
});
var myResultSet = mysearch.run();
for(var i=0; i < myResultSet.length; i++){
if( schoolName === myResultSet[i].values.custentity_lf_school_list[0].text){
var CustomerId = myResultSet[i].id;
var id = record.submitFields({
type: record.Type.CUSTOMER,
id:CustomerId,
values: {
'custentity_lf_hdwr_roy_new': headwearRoyalty,
'custentity_lf_std_roy_rate_new' : standardRoyalty
}
})
}
}
}
ehcanadian
06/07/2023, 2:42 PMschoolName
and myResultSet[i].values.custentity_lf_school_list[0].text
. One may be a numberKevin Baxter
06/07/2023, 2:47 PMehcanadian
06/07/2023, 2:47 PMgetText
instead of getValue