Client Script with entry point postSourcing can be used.
function postSourcing(scriptContext) {
var currentRec = scriptContext.currentRecord;
var type_of_delivery = currentRec.getValue({
fieldId: 'custbody_jj_type_of_delivery'
})
if (type_of_delivery == 7 || type_of_delivery == 8) {
var location_display = currentRec.getCurrentSublistText({
sublistId: 'item',
fieldId: 'location_display'
});
var tax = salestaxSearch(location_display);
currentRec.setCurrentSublistText({
sublistId: 'item',
fieldId: 'taxrate1',
text: tax,
ignoreFieldChange: true
});
}
function salestaxSearch(location_display) {
var tax_rate;
var salestaxitemSearchObj = search.create({
type: "salestaxitem",
filters:
[
["city", "is", location_display]
],
columns:
[
search.createColumn({name: "rate", label: "Rate"})
]
});
var searchResultCount = salestaxitemSearchObj.runPaged().count;
salestaxitemSearchObj.run().each(function (result) {
tax_rate = result.getValue(search.createColumn({name: "rate", label: "Rate"}))
});
return tax_rate;
}