Vikash Poddar
05/02/2025, 6:47 AMCeligo AI
05/02/2025, 6:47 AMAI generated answer (using internal Slack threads):Based on the conversations, it seems like you are trying to set a custom field 'Origin Country' on the Sales Order line with the value of the 'Manufacturer Country' from the Item record. Here is a sample script that you can use as a reference:
javascript
function fieldChanged(context) {
try{
var salesOrderRecord = context.currentRecord;
var sublistName = context.sublistId;
var fieldName = context.fieldId;
var lineCount = salesOrderRecord.getLineCount('item');
for(var i = 0; i < lineCount; i++){
if(sublistName === 'item' && fieldName === 'item'){
var item = salesOrderRecord.getCurrentSublistValue({
sublistId : 'item',
fieldId : 'item'
});
var itemType = salesOrderRecord.getCurrentSublistValue({
sublistId : 'item',
fieldId : 'itemtype'
});
var manufactureCountry = search.lookupFields({
type : itemType,
id : item,
columns : ['countryofmanufacture']
})['countryofmanufacture'];
if(manufactureCountry){
salesOrderRecord.setCurrentSublistValue({
sublistId : 'item',
fieldId : 'custcol_country_of_origin_name',
value : manufactureCountry
});
}
}
}
}catch(e){log.error('error',e);}
}
This script uses the fieldChanged
event of the Client Script to get the 'Manufacturer Country' from the Item record and set it to the 'Origin Country' field on the Sales Order line.
Please note that you need to replace 'custcol_country_of_origin_name'
with the actual ID of your custom field. Also, ensure that the custom field is properly set up and is not disabled or set as inline text, as these settings can prevent the field from being updated.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
05/02/2025, 6:47 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.816138566
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.813540399
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810899854
Celigo AI
05/02/2025, 6:47 AM