Version: eXtendWebApproval 1.0.9
Audience: Administrator

Use Case

  • Add easy-to-click buttons to approve or reject transactions using NetSuite's native Advanced PDF/HTML Templates or Email Templates.

PDF Template Configuration 

Once you have configured eXtendWebApprovals and deployed the necessary scripts, you will need to add code to the Advanced PDF/HTML Templates in order to display a Yes/No button.

  1. Go to Setup → Customization → Forms → Advanced PDF/HTML Templates and click Customize on the transaction template where you want to show WebApprovals. 
    Image Placeholder 

  2. Toggle to the Source Code view to show the source code for the template. When toggled on, the page will refresh, and a green check mark will be shown to indicate its enablement.

    Image Placeholder 

    Image Placeholder 

    Scroll through the source code until you find the section where the Yes / No buttons should be added and paste the code snippet below. In this example we’ve added the snippet before the closing </body> tag in the template.

    <#if record.custbody_extend_web_approval_url?has_content><table class="total" style="width: 100%; margin-top: 10px;">
        <tr class="grandtotal" style="background-color: #a5a8aa; color: #fff;">
            <td align="right" style="font-family: contentfontL"  vertical-align="middle">Do you acknowledge this order?
            <a href="${record.custbody_extend_webaprvl_url + record.entity}" name="Approval" style="margin: 2px; color: #fff; text-decoration:none;cursor:pointer;background-color: #0c5e82;padding: 5px 20px; text-align: center;">Yes</a>
            <a href="${record.custbody_extend_web_apprvl_rej_url + record.entity}" name="Rejection" style="margin: 2px; color: #fff; text-decoration:none;cursor:pointer;background-color: #f36f21;padding: 5px 20px; text-align: center;">No</a>
            </td>
        </tr>
    </table>
    </#if>

  3. Use the Preview button to view the change.  

  4. If there are no validation errors and if the form looks like you expect, click Save to commit your changes to the PDF template. 

    Image Placeholder

Email Template Configuration 

Once you have configured eXtendWebApprovals and deployed the necessary scripts, you will need to add code to the Email Templates in order to display a Yes/No button.

  1. Go to Documents → Templates → Email Templates. 

    Image Placeholder  

  2. Open the email template which you would like to add the approval buttons. 

  3. Add the code snippet below.
    Note: The snippet below is for an email template on the Purchase Order record. For the Sales Order record, replace ${vendor.companyname} with ${customer.companyname}.

<div class="approval">
    <h3><span style="font-family: 'Montserrat', sans-serif;">Do you approve this order?</span></h3>
    <span style="font-family: 'Montserrat', sans-serif;">
        <!--[if mso]>
          <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${transaction.custbody_extend_webaprvl_url}${transaction.entity}" style="height:40px;v-text-anchor:middle;width:100px;" arcsize="10%" strokecolor="#0c5e82" fillcolor="#0c5e82">
            <w:anchorlock/>
            <center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight: 400;">YES</center>
          </v:roundrect>
        <![endif]--><a href="${transaction.custbody_extend_webaprvl_url}${transaction.entity}"
            style="background-color:#0c5e82;border:1px solid #0c5e82;border-radius:4px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:13px;font-weight: 400;line-height:40px;text-align:center;text-decoration:none;width:100px;-webkit-text-size-adjust:none;mso-hide:all;">YES</a>
        <!--[if mso]>
          <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${transaction.custbody_extend_web_apprvl_rej_url}${transaction.entity}" style="height:40px;v-text-anchor:middle;width:100px;" arcsize="10%" strokecolor="#f36f21 " fillcolor="#f36f21">
            <w:anchorlock/>
            <center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight: 400;">NO</center>
          </v:roundrect>
        <![endif]-->&nbsp; &nbsp;<a href="${transaction.custbody_extend_web_apprvl_rej_url}${transaction.entity}"
            style="background-color:#f36f21;border:1px solid #f36f21 ;border-radius:4px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:13px;font-weight: 400;line-height:40px;text-align:center;text-decoration:none;width:100px;-webkit-text-size-adjust:none;mso-hide:all;">NO</a>
    </span>
</div>
Image Placeholder

Note: If the username or entity name which is being used for the “approval user” snippet consists of special characters like &<, >, the characters after the special character will not be saved in the approval user field due to XML parsing limitations in FreeMarker engine used by NetSuite.

To work around this limitation, we have provided the script parameter EXTENDWEBAPPROVAL ENTITY FIELD ID where you can define the field ID of the entity you will be using for the approval user. The value of the specified field will be parsed by the WebApproval scripts and it will be saved in the hidden field custbody_extend_web_approval_user_hdn on your record and use this field in your templates for specifying the eXtendWebApproval user. 

Image Placeholder