Levi Pruss
12/12/2025, 3:05 AMCeligo AI
12/12/2025, 3:05 AMAI generated answer (using internal Slack threads):To create a vendor bill custom line field with a default value that applies to the transaction (PO link), you can use SuiteScript or a workflow. If you're using SuiteScript, you can create a User Event script that triggers on the 'After Submit' event of the Vendor Bill record. This script would then loop through the line items of the Vendor Bill, and for each line item, it would set the value of the custom field to the internal ID of the related Purchase Order. Here's a basic example of how this might look in SuiteScript 2.0:
javascript
define(['N/record'], function(record) {
function afterSubmit(context) {
var newRecord = context.newRecord;
var lineCount = newRecord.getLineCount({sublistId: 'item'});
for (var i = 0; i < lineCount; i++) {
var poLink = newRecord.getSublistValue({
sublistId: 'item',
fieldId: 'orderdoc',
line: i
});
newRecord.setSublistValue({
sublistId: 'item',
fieldId: 'custcol_po_link',
line: i,
value: poLink
});
}
record.submitFields({
type: newRecord.type,
id: newRecord.id,
values: {
'custbody_po_link': poLink
}
});
}
return {
afterSubmit: afterSubmit
};
});
In this script, 'custcol_po_link' is the ID of the custom line field on the Vendor Bill, and 'orderdoc' is the standard field that holds the link to the Purchase Order.
If you're using a workflow, you can create a 'Set Field Value' action that sets the value of the custom field to the internal ID of the related Purchase Order. You can use a formula like {appliedtotransaction.internalid} to get this value. This action should be triggered 'After Record Submit'.
******
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
12/12/2025, 3:05 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83605969
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832641661
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829711914
Celigo AI
12/12/2025, 3:05 AM