Imran Hasan
10/27/2024, 10:37 AMCeligo AI
10/27/2024, 10:37 AMAI generated answer (using internal Slack threads):To add a custom field in an estimate that shows the sales invoice created from that transaction, you can follow these steps: 1. Navigate to
Customization > Lists, Records, & Fields > Transaction Body Fields > New
.
2. In the Label field, enter a name for your custom field, for example, "Sales Invoice".
3. In the Type field, select "Free-Form Text" or "List/Record" depending on your needs.
4. In the Applies To field, select "Estimate".
5. In the Display subtab, you can set the custom field to be displayed on the main line by checking the "Main Line" checkbox.
6. Save the custom field.
Now, to populate this field with the sales invoice created from the estimate, you would need to create a User Event script or a Workflow that triggers when the sales invoice is created from the estimate. This script/workflow would then populate the custom field on the estimate with the internal ID or the document number of the sales invoice.
Here is a basic example of how the User Event script might look:
javascript
function afterSubmit(context) {
if (context.type !== context.UserEventType.CREATE)
return;
var newInvoice = context.newRecord;
var createdFrom = newInvoice.getValue('createdfrom');
if (createdFrom) {
var estimateRecord = record.load({
type: record.Type.ESTIMATE,
id: createdFrom
});
estimateRecord.setValue('custbody_sales_invoice', newInvoice.id);
estimateRecord.save();
}
}
This script loads the estimate from which the invoice was created, sets the custom field with the ID of the new invoice, and then saves the estimate.
******
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
10/27/2024, 10:37 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839991033
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824402928
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82150346
Celigo AI
10/27/2024, 10:37 AM