I cored a saved search, and when I logdebug the results appear as I want. but when I try to set the value to the destination field, there is no response with any results.
if(cust){
var custSave = search.create({
type: "customrecord_me_customer_sales_person",
filters:
[
["custrecord_me_customer_name","is",cust],
],
columns:
[
search.createColumn({name: "custrecord_me_customer_name", label: "ME - Customer Name"}),
search.createColumn({
name: "custrecord_me_join_sales_person",
sort: search.Sort.ASC,
label: "ME - Join Customer Sales Person"
})
]
});
log.debug(
"sales person"+JSON.stringify(custSave)
);
var custSR = custSave.run().getRange(0, 1000);
var cust = custSR[0].getText("custrecord_me_join_sales_person");//the result I want in
log.debug(
"join customer sales person"+JSON.stringify(cust)
);
return true;
if (cust.hasOwnProperty('custrecord_me_join_sales_person')){
var salesPerson = cust.getValue('custrecord_me_join_sales_person')[0].value;
//var salesPerson = currentRecord.getValue({"custrecord_me_join_sales_person"});
currentRecord.setValue({ fieldId: 'custbody_me_field_deposit_salesman', value: salesPerson });
}
else{
currentRecord.setValue({ fieldId: 'custbody_me_field_deposit_salesman', value: null });
}
}
}
}
return {
fieldChanged: fieldChanged
}
is there an error in my script (there is no error notification). thanks for answering