mescalante
03/26/2025, 8:24 PMCeligo AI
03/26/2025, 8:24 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that you are trying to auto-populate certain fields in a Purchase Order based on the associated Purchase Contract. This can be achieved using a client script in SuiteScript. The script should be triggered when the 'purchasecontract' field is changed. The script will then load the associated Purchase Contract record, retrieve the necessary field values, and set these values in the corresponding fields of the Purchase Order. Here is a sample code snippet from the conversation:
javascript
function fieldChanged(context) {
var po = context.currentRecord;
if (context.fieldId == 'purchasecontract') {
var pcSelected = po.getValue({ fieldId: 'purchasecontract' });
if (pcSelected !== null) {
var newpc = po.getValue({ fieldId: 'purchasecontract' });
var pc = record.load({
type: record.Type.PURCHASE_CONTRACT,
id: newpc
});
var pcitemType = pc.getValue('custbody_byu_po_item_type');
var pcpoType = pc.getValue('custbody_byu_po_type');
var subsidiary = pc.getValue('subsidiary');
var location = pc.getValue('location');
var fundSource = pc.getValue('custbody_byu_pc_funding_source');
if (pcitemType) {
po.setValue({ fieldId: 'custbody_byu_po_item_type', value: pcitemType })
}
if (pcpoType) {
po.setValue({ fieldId: 'custbody_byu_po_type', value: pcpoType })
}
if (subsidiary) {
po.setValue({ fieldId: 'subsidiary', value: subsidiary })
}
if (location) {
po.setValue({ fieldId: 'location', value: location })
}
if (fundSource) {
po.setValue({ fieldId: 'custbody_byu_po_funding_source', value: fundSource })
}
}
}
return true
}
This script will populate the 'custbody_byu_po_item_type', 'custbody_byu_po_type', 'subsidiary', 'location', and 'custbody_byu_po_funding_source' fields in the Purchase Order based on the values in the associated Purchase Contract.
******
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
03/26/2025, 8:24 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.833310723
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81205
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.810565591
Celigo AI
03/26/2025, 8:24 PM