I apologize in advance, I am very new to JavaScript and NetSuite.
I'm utilizing the DocuSign for NetSuite bundle. The bundle has options to use their functions within a button.
PROBLEM: I'm attempting to take a field value from NetSuite and combine it into a custom email subject field. For example, Opportunity Status.
Is this supported by SuiteScript? If so, how?
JavaScript in general seems to support it by using the syntax of "This is dynamic + 'customVariableName'."
Below is my script and thanks in advance:
function oppStatus () {
var status = nlapiGetFieldText('status');
}
function customSendMain () {
var searches = [
{ keyword: '.docx .doc'
, type: 'broad' }
];
var staticEmail = {
subject: 'Opportunity ' + status,
blurb: 'Static email blurb'
};
var recipients = docusignGetRecipients(docusignContext);
var files = docusignGetFiles(docusignContext, searches);
var email = staticEmail;
return docusignPopulateEnvelope(docusignContext, recipients, files, email);
}
"email" within the "docusignPopulateEnvelope" is an object. "subject" and "blurb" contain string values.
How can I reference a variables value within the string for either "subject" OR "blurb"? I keep getting syntax errors.
Also tried it like this:
var staticEmail = {
subject: Opportunity ' ' .status,
blurb: 'Static email blurb'
};