How to compose an email and have that same email sent to multiple records

Marcus
Kilo Contributor

I am attempting to add a feature to our major case fulfillment process where a user has the ability to click a UI action that will open a tab for them to compose an email. Once that email is sent, it will also send for the child cases related to that major case. I have configured that ui action fairly easily but I am unsure as to how to configure the logic to trigger a notification for all associated child cases 

UI action: 

function openEmailClient() {
    var id = g_form.getUniqueValue();
    var name = g_form.getValue('name');
    var url = 'email_client.do?sysparm_table=&sysparm_sys_id=' + id + '&email_client_template=';
    popupOpenEmailClient(url);

    if (typeof window == 'undefined')
        setStatus(); //Server function

    function setStatus() {
        current.u_status = 'Close';
        current.update();
    }
}
4 REPLIES 4

Brad59
Giga Guru

There are likely a lot of ways to solve this. What first came to my mind is to make a while loop that triggers an event for each case associated with your major case. Then that event is the trigger for the email.

Marcus
Kilo Contributor

Hey Brad! Thank you for your recommendation, I really like your idea. Now would this logic live in a business rule or flow? 

I would use a business rule but that is just because of familiarity. However, it is likely a Flow could solve it as well. I'm not sure how the manual emails work though. You may have to pass the recipients and the body of the email as event parameters.

There may also be a way to handle it in the setStatus function of your UI Action.

Pavan Vasudeva
Tera Contributor

Hi Marcus,

 

I had the requirement to create Compose Email UI action on classic UI and tried your above code but the Ui action is not working with the code. Do I need to add anything extra in the scripting part? Kindly help.

 

Regards,

Pavan