Notifications

12 views

Description

The OOB notification "Contract Approval Request" used for contracts includes incorrect details under 'Approval activity' in the email. This issue occurs because the notification uses the approval_activity mail script which is applicable only for task records (sc_request, change_request, etc.).

Steps to Reproduce

Trigger the notification "Contract Approval Request" ( /sysevent_email_action.do?sys_id=d0ecc4174770300042bd757f2ede2743 ).

Notice in the sent email's body that the Approval activity shows incorrect information.

Workaround

This problem has been fixed in Madrid. If you are able to upgrade, review the Fixed In section to determine the latest version with a permanent fix your instance can be upgraded to.

For contact records, you can apply the following workaround: 

  1. Navigate to sys_script_email.list from the filter navigator. 
  2. Click on 'New' to create a new email script. 
  3. Name the script 'approval_activity_contract'.
  4. Paste the below script:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    (function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
        /* Optional EmailOutbound */
        email, /* Optional GlideRecord */ email_action,
        /* Optional GlideRecord */
        event) {
        var approvers = new GlideRecord('sysapproval_approver');
        approvers.addNotNullQuery('approver');
        approvers.addQuery('approver', '!=', current.approver);
        if (!gs.nil(current.getValue("sysapproval"))) {
            approvers.addQuery('sysapproval', current.sysapproval);
        }
        approvers.addQuery('document_id', current.document_id);
        approvers.addQuery('state', 'IN', 'approved,rejected,requested');
        approvers.orderBy('approver');
        approvers.query();
        var limit = 20;
        approvers.setLimit(limit);
        if (approvers.getRowCount() > 0) {
            while (approvers.next()) {
                template.print(approvers.approver.getDisplayValue() + ' - ' + approvers.state.getDisplayValue() + '<br/>');
            }
            if (approvers.getRowCount() > limit) {
                template.print('Additional approvers are available and require viewing the record.<br/>');
            }
        } else {
            template.print('You are the sole approver.<br/>');
        }
    
    })(current, template, email, email_action, event);
    
  5. Save the record.
  6. Open the 'Contract Approval Request' notification ( /sysevent_email_action.do?sys_id=d0ecc4174770300042bd757f2ede2743 ).
  7. In the Message field, replace the line:
    ${mail_script:approval_activity}
    with:
    ${mail_script:approval_activity_contract}
  8. Save the record.


Related Problem: PRB1312872

Seen In

There is no data to report.

Fixed In

Madrid

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-09-05 18:13:10
Published:2019-07-24