I have a user event script that creates buttons on...
# suitescript
p
I have a user event script that creates buttons on a Message form and when clicked they populate email addresses in the recipient field. Is there a way to instead of having buttons have a drop down where the user can select the type of email and then the recipient is populated:
Copy code
function beforeLoad(scriptContext) {
            var userObj = runtime.getCurrentUser();
            var userRole = userObj.role;            
            var userId = userObj.id;
            var form = scriptContext.form;
            var emailRecord = scriptContext.newRecord;

            scriptContext.form.clientScriptModulePath = 'SuiteScripts/email_button_emails.js';
            if (userRole == 1009 || userRole == 1010) {
                form.addButton({
                    id: "custpage_billing_email",
                    label: "Billing Email",
                    functionName: "billingemail"
                })
            } else if (userId == 168 || userId == 48911) {
                form.addButton({
                    id: "custpage_email1_email",
                    label: "Email 1",
                    functionName: "email1"
                });
            } 
                form.addButton({
                    id: "custpage_email2_email",
                    label: "Email 2",
                    functionName: "email2"
                });

                form.addButton({
                    id: "custpage_email3_email",
                    label: "Email 3",
                    functionName: "email3"
                });
        }