Ability (custom.js) to add secondary recipient in Send Email
When analyst's send emails through the Portal, the comments get logged into the Action Log properly, but show up as E-mail Sent, not a regular analyst comment.
I'm looking to automatically append '; helpdesk@mycompany.com' to the Recipient text entry for the send email.
I've been trying to base something off of the following to enter the text, but I just can't grab the recipient box in order to add it.
app.custom.formTasks.add('Incident', null, function (formObj, viewModel) { <br>
/* https://community.cireson.com/discussion/145/improvements-of-send-email */ <br>
//bind a function to the form ready event <br>
formObj.boundReady(function () { <br>
$(".link[data-bind*=sendEmail]").on("click", function () { <br>
$("#IsAddToLog").trigger("click").closest("div"); <br>
$("#ChangeStatusToPending").closest("div"); <br>
} <br>
); <br>
}); <br>
}); <br>
Hopefully one of you JS masters can assist!Thanks!
Best Answer
-
Nicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭One further note-- the above version does have some problems with the newer versions of IE, and sometimes has issues with certain GPOs. A newer/more IE-compatible way to implement this same functionality is as follows:app.custom.formTasks.add('ServiceRequest', null, function (formObj, viewModel) {formObj.boundReady(function(){var vm = pageForm.viewModel;var toemail = "";if(vm.RequestedWorkItem.BaseId != null && vm.RequestedWorkItem.UPN != null){toemail = vm.RequestedWorkItem.UPN;}var subject = "[" + vm.Id + "] - " + vm.Titlevar CC = "test@SCSM.lab"var emailtitle = $( ".taskmenu li:contains('Send Email')" ).after("<a style='padding-top: 4px; padding-bottom: 4px; font-size: 14px; text-transform: lowercase' href='mailto:" + toemail + "?subject=" + subject + "&CC=" + CC +"' > Send Email Outlook</a>");});return;});6
Answers
Above is the code used to add it to the SR form.