Shelby Owens
06/11/2025, 2:23 PMCeligo AI
06/11/2025, 2:23 PMAI generated answer (using internal Slack threads):To add a button to a case record that opens a new quote in edit mode with some fields filled in from the case fields, you can use a combination of SuiteScript's User Event and Client scripts. Here's a step-by-step guide: 1. Create a User Event script that adds a button to the case record when it's in view mode. This script will also link to a Client script that will be triggered when the button is clicked.
javascript
function beforeLoad(context) {
context.form.addButton({
id: "custpage_quote_button",
label: "Create Quote",
functionName: "OPEN_QUOTE_FORM"
});
context.form.clientScriptModulePath = "SuiteScripts/display_quote_button_cs.js";
}
2. Create a Client script that will be triggered when the button is clicked. This script will open a new quote in edit mode and fill in some fields from the case record.
javascript
function OPEN_QUOTE_FORM() {
var caseRecord = record.load({
type: record.Type.CASE,
id: context.newRecord.id
});
var quoteRecord = record.create({
type: record.Type.ESTIMATE,
isDynamic: true
});
quoteRecord.setValue({
fieldId: 'entity',
value: caseRecord.getValue('company')
});
// Add more fields as needed...
var quoteId = quoteRecord.save();
var quoteUrl = url.resolveRecord({
recordType: 'estimate',
recordId: quoteId,
isEditMode: true
});
window.open(quoteUrl);
}
return {
pageInit: pageInit,
OPEN_QUOTE_FORM: OPEN_QUOTE_FORM
};
Please note that you need to replace 'SuiteScripts/display_quote_button_cs.js'
with the actual path to your Client script file. Also, replace 'company'
with the actual field id from the case record that you want to copy to the quote.
******
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
06/11/2025, 2:24 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846411347
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845482826
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843207896
Celigo AI
06/11/2025, 2:24 PM