Home Analyst Portal
Options

Ability (custom.js) to add secondary recipient in Send Email

Mike_RistonMike_Riston Customer IT Monkey ✭
I'm working on a PowerShell workflow for all of our incidents (to rev status based on comments and what not) and I'm using SMLets. To gather the comments, I'm using SMLets to look at the .AppliesToTroubleTicket data of a specific Incident.

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

Answers

  • Options
    Mike_RistonMike_Riston Customer IT Monkey ✭
    To clarify a little further, I'm wanting to add my helpdesk into the TO: box as to have it enter it in as another analyst comment such that it'd be logged properly so I can pick up the comment with SMLets for my workflow script.
  • Options
    Jonathan_BolesJonathan_Boles Customer Ninja IT Monkey ✭✭✭✭
    +1 @Mike_Riston, this is something that would be really handy at capturing the outbound communications. We've also added a Send Email via Outlook task that prepopulates the Work Item # and auto-fills the to: section with the affected user and the cc: section with our primary mailbox being used with SCSM. Would be great to have this work with the send email task too!
  • Options
    Mike_RistonMike_Riston Customer IT Monkey ✭
    +1 @Mike_Riston, this is something that would be really handy at capturing the outbound communications. We've also added a Send Email via Outlook task that prepopulates the Work Item # and auto-fills the to: section with the affected user and the cc: section with our primary mailbox being used with SCSM. Would be great to have this work with the send email task too!
    Are you calling the "Send Email via Outlook" from an actual SM task in the "fat" console or have you somehow linked that into the Cireson Analyst Portal?
  • Options
    Jonathan_BolesJonathan_Boles Customer Ninja IT Monkey ✭✭✭✭
    edited September 2016
    @Mike_Riston, we have it linked into the Cireson Portal as a custom task.

    app.custom.formTasks.add('ServiceRequest', "Send Email via Outlook", function (formObj, viewModel) {
        var affectedUserId = (viewModel.RequestedWorkItem) ? viewModel.RequestedWorkItem.BaseId : "";
        $.ajax({
            url: "/EmailNotification/GetffectedUserEmail",
            data: { baseId: affectedUserId },
            type: "GET",
            success: function (data) {
                affectedUserEmail = data;
                var win = window.open("mailto:" + affectedUserEmail + "?cc=" + localization.EnvEmail + "&Subject=[" + viewModel.Id + "]%20-%20" + viewModel.Title, '_blank');
                win.focus();
    			//window.close();
    			win.close();
            }
        });
    });
    Above is the code used to add it to the SR form.
  • Options
    Jonathan_BolesJonathan_Boles Customer Ninja IT Monkey ✭✭✭✭
    @Mike_Riston, we have it linked into the Cireson Portal as a custom task.

    app.custom.formTasks.add('ServiceRequest', "Send Email via Outlook", function (formObj, viewModel) {
        var affectedUserId = (viewModel.RequestedWorkItem) ? viewModel.RequestedWorkItem.BaseId : "";
        $.ajax({
            url: "/EmailNotification/GetffectedUserEmail",
            data: { baseId: affectedUserId },
            type: "GET",
            success: function (data) {
                affectedUserEmail = data;
                var win = window.open("mailto:" + affectedUserEmail + "?cc=" + localization.EnvEmail + "&Subject=[" + viewModel.Id + "]%20-%20" + viewModel.Title, '_blank');
                win.focus();
    			//window.close();
    			win.close();
            }
        });
    });
    Above is the code used to add it to the SR form.
    I should add - much credit our awesome Cireson Consultant @Nicholas_Velich for devloping this great task!
  • Options
    Nicholas_VelichNicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭
    One quick note on the above code @Jonathan_Boles posted is that it is using a localization key "EnvEmail"-- you would need to add this localization to your environment or replace it directly in the code with the email account of your Exchange Connector.
Sign In or Register to comment.