Approval notification RITM to show group approval for specific assignment group manager

Joshua Wolfe
Tera Expert

Hello, I was hoping to get help/guidance on how to move forward. 

I have a request that allows a user to select and add groups to a multi-row variable set.  On the REQ it produces an email that we have designed through email notification script to show the values from the multi-row variable set to the default submitter's manager for approval. 

However, on the RITM I need it to produce an approval email to each assignment group manager selected showing only the assignment groups that manager owns (to avoid approval confusion) - Does anyone know the best way to do this?

 

I tried to mimic the email script for REQ to go one level deeper, but I am missing something here.

2 REPLIES 2

Saloni Suthar
Mega Sage
Mega Sage

Please share your script


If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni

Joshua Wolfe
Tera Expert

The first if statement works correctly on the REQ but the second if statement is my attempt to get the notification sent on the RITM.

 

            if (gr.cat_item == 'fb8a42561be601d0325a641b24b8bdb') {
                var mrvs;
                mrvs = gr.variables.group_additions; //mrvs internal_name
                var rowCount = mrvs.getRowCount();
                template.print("<table>");
                for (var i = 0; i < rowCount; i++) {
                    var row = mrvs.getRow(i);
                    var groupName = '';
                    var grName = new GlideRecord("sys_user_group");
                    grName.addQuery("sys_id", row.my_group);   //row.name of variable within the MRVS
                    grName.query();
                    if (grName.next()) {
                    groupName = grName.name;
                    template.print("<tr>");
                    template.print("<td>" + "My Group" + (i+1).toString() + ": " + groupName + "</td>");
                    template.print("</tr>");}
                }
                template.print("</table>");
            }

            if ((gr.cat_item == 'fb8a42561be601d0325a641b24b8bdb') && (sc_req_item.short_description == 'Use this to request access' )) {
                var mrvs;
                mrvs = gr.variables.group_additions; //mrvs internal_name
                var rowCount = mrvs.getRowCount();

                template.print("<table>");
                for (var i = 0; i < rowCount; i++) {
                    var row = mrvs.getRow(i);
                    var groupName = '';
                    var grName = new GlideRecord("sys_user_group");
                    grName.addQuery("sys_id", row.my_group);   //row.name of variable within the MRVS
                    grName.query();
                    if (grName.next()) {
                    groupName = grName.name;
                    template.print("<tr>");
                    template.print("<td>" + "My Group" + (i+1).toString() + ": " + groupName + "</td>");
                    template.print("</tr>");}
                }
                template.print("</table>");
            }