Shelby Owens
06/13/2025, 4:57 PMCeligo AI
06/13/2025, 4:58 PMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To create a quote with line items from a custom record, you can use SuiteScript. Here's a general approach: 1. Create a User Event Script: This script will be triggered when the user selects a button on the custom record. 2. Gather Line Item Data: In the User Event Script, you can gather the line item data from the child custom record. You can use the
record.selectNewLineItem
and record.setCurrentLineItemValue
methods to do this.
3. Create a Quote Record: Still within the User Event Script, you can create a new quote record using the record.create
method.
4. Set Line Items on Quote: For each line item gathered from the custom record, you can use the record.selectNewLine
and record.setCurrentSublistValue
methods to set the line items on the quote.
5. Save the Quote: Finally, you can save the quote using the record.save
method.
Here's a simplified example of what the code might look like:
javascript
var customRecord = record.load({
type: 'customrecord_my_custom_record',
id: myCustomRecordId
});
var quote = record.create({
type: record.Type.ESTIMATE,
isDynamic: true
});
for (var i = 0; i < customRecord.getLineCount({sublistId: 'recmachcustrecord_child_record'}); i++) {
var itemId = customRecord.getSublistValue({
sublistId: 'recmachcustrecord_child_record',
fieldId: 'custrecord_item',
line: i
});
var quantity = customRecord.getSublistValue({
sublistId: 'recmachcustrecord_child_record',
fieldId: 'custrecord_quantity',
line: i
});
var price = customRecord.getSublistValue({
sublistId: 'recmachcustrecord_child_record',
fieldId: 'custrecord_price',
line: i
});
quote.selectNewLine({
sublistId: 'item'
});
quote.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'item',
value: itemId
});
quote.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: quantity
});
quote.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'rate',
value: price
});
quote.commitLine({
sublistId: 'item'
});
}
var quoteId = quote.save();
Please note that this is a simplified example and you may need to adjust it to fit your specific needs. For example, you may need to set additional fields on the quote, handle errors, or optimize for performance.Celigo AI
06/13/2025, 4:58 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851837635
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850170314
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849862218
Celigo AI
06/13/2025, 4:58 PM