Skip to main content
Skip table of contents

Nimble Create Extensions

Out of the box, Nimble Create supports template-based HTML wrapped as an Apex Component - this enables admins and staff with the proper permissions to develop Apex pages and Salesforce Emails without needing to write Apex code. Nimble Create Extensions expands upon this and adds support for the following features:

  • Emailing (single and in bulk)
  • Printing (in bulk)
  • Launching a set of templates from a List View

If you are interested in Nimble Create Extensions and this has not already been implemented for you, please reach out to Nimble AMS Support for enablement.


Requirements

In order for Nimble AMS Support to enable Nimble Create Extensions, the following requirement(s) must be in place:

  • Nimble Create, version 1.19 or higher

Supporting List Views

List Views are a convenient method of selecting up to 200 records at a time to generate mass invoices for printing or emailing purposes. In order to support list views you must author:

  1. A short Apex Class which is cut-and-paste, with a few substitutions
  2. A short Apex Test Class which is cut-and-paste, with a few substitutions
  3. A Visualforce Page which is cut-and-paste, with a few substitutions
  4. Two buttons: one for the list view and one for the page layout
  5. Edit the page layout to include the single button, and edit the search layout to include the list view button

Creating the Apex Class

  1. From Setup, Search and Navigate to "Apex Classes" in your Staging Environment or connected Sandbox
    1. Apex Classes can not be created directly in Production and will need to be moved via Changeset after creation and testing in Staging or a connected Sandbox.
  2. Author an Apex Class titled NTFTemplateNameController.cls, where TemplateName is the name of your Nimble Create Template or the Object the Template is based on.
  3. Cut and paste the code below.

    1. Click here to expand...
      CODE
      /**
       * @description Displays an Cart report, based on NTFViewerController
       */
      public with sharing class NTFCartController extends NUTPLX.NTFViewerController {
       
          @testVisible private static final String NIMBLE_FRAME = 'NTFCart';
       
          /**
           * @description Retrieves the selected record(s) and builds the report based on NTFViewerController
           */
          public NTFCartController(ApexPages.StandardSetController controller) {
              super (controller);
          }
       
          /**
           * @description Specifies the Nimble Create template
           * @returns The SFID of the Nimble Create template
           */
          public override Id getNimbleTemplateReference() {
              return getNimbleTemplateReferenceFromFrame(NIMBLE_FRAME);
          }
      }
      1. Substitute the description on line 2 by replacing "Cart" with the name of the Object the Template is based on.
      2. Substitute the class name "NTFCartController" on line 4 with your class name.
      3. Substitute the string label 'NTFCart' on line 6 with the name of your class name without the 'Controller' suffix.
      4. Substitute the method name on Line 11 with the class name identified in ii. above.

Creating the Apex Test Class

  1. From Setup, Search and Navigate to "Apex Classes" in your Staging Environment or connected Sandbox
    1. Apex Classes can not be created directly in Production and will need to be moved via Changeset after creation and testing in Staging or a connected Sandbox.
  2. Author an Apex Class titled NTFTemplateNameControllerTest.cls, where TemplateName is the name of your Nimble Create Template or the Object the Template is based on.
  3. Cut and paste the code below.

    1. Click here to expand...
      CODE
      @isTest
      private class NTFCartControllerTest {
          @isTest
          static void getNimbleTemplateReference_noParams_success() {
              setupPage();
              ApexPages.currentPage().getParameters().put('id', null);
              NTFCartController cart = loadController(new List<NU__Cart__c>());
              System.assertEquals(null, cart.getNimbleTemplateReference());
          }
       
          private static void setupPage() {
              PageReference pageRef = new PageReference('/apex/NTFCart');
              Test.setCurrentPage(pageRef);
          }
       
          private static NTFCartController loadController(List<NU__Cart__c> carts){
              ApexPages.StandardSetController setController = new ApexPages.StandardSetController(carts);
              setController.setSelected(carts);
              return new NTFCartController(setController);
          }
      }
      1. Substitute the test class name "NTFCartControllerTest" (on line 2) with your test class name.
      2. Substitute all instances the class name "NTFCartController" (on lines 7, 16 and 19) with your class name.
      3. Substitute all instances the variable name "cart" (on line 7 and on line 8) with the name of the Object the Template is based on.
      4. Substitute all instances the variable name "carts" (on line 16, 17, and 18) with the name of the Object the Template is based on in plural.
      5. Substitute all instances the object API name "NU__Cart__c" (on line 7 and on line 16) with the name of the API name of the Object the Template is based on.
      6. Substitute the VisualForce page name "NTFCart" (on line 12) with the name of your controller, minus the word "Controller".

Creating the Visualforce Page

  1. From Setup, Search and Navigate to "Visualforce Page" in your Staging Environment
    1. As Apex Classes can not be created directly in Production, all base creation and testing must take place in a sandbox environment
  2. Author a Visualforce Page titled NTFTemplateName.page, where TemplateName is the name of your Nimble Create Template or the Object the Template is based on.
  3. Cut and paste the code below.

    1. Click here to expand...
      CODE
      <apex:page title="{!NimbleTemplateName}" standardController="NU__Cart__c" renderAs="{!Render}" extensions="NTFCartController" showHeader="false" sidebar="false" standardStylesheets="false" recordsetvar="a" id="page">
          <apex:composition template="NUTPLX__NTFViewerTemplate">
              <apex:define name="stylesheet"><apex:stylesheet value="{!URLFOR($Resource[Stylesheet])}" /></apex:define>
              <apex:define name="templateName">{!NimbleTemplateName}</apex:define>
              <apex:define name="listSize">{!ListSize}</apex:define>
              <apex:define name="overSizeMessage">
                  <apex:outputPanel rendered="{!ListSize > 25}">
                       • 1 item displayed. The Email and Print/PDF features will generate all selected items.
                  </apex:outputPanel>
              </apex:define>
       
              <apex:define name="printScript">
                  <apex:outputText value="{!PrintScript}" />
              </apex:define>
       
              <apex:define name="templateButtons">
                  <apex:commandButton value="Generate"
                      action="{!generate}"
                      styleClass="slds-button slds-button--neutral"
                      title="Generates report." />
                  <apex:commandButton value="Email"
                      action="{!email}"
                      styleClass="slds-button slds-button--neutral"
                      rendered="{!CanRender}"
                      title="Emails the report to all records that have an email." />
                  <apex:commandButton value="Print/PDF"
                      action="{!print}"
                      styleClass="slds-button slds-button--neutral"
                      rendered="{!CanRender}"
                      title="Opens the print window for small batches, and creates a single report to print/PDF for large batches." />
                  <apex:commandButton value="Cancel"
                      action="{!cancel}"
                      styleClass="slds-button slds-button--neutral"
                      title="Cancel report and return to the last page." />
              </apex:define>
       
              <apex:define name="additionalRecipients">
                  <apex:outputPanel rendered="{!ListSize == 1}">
                      <div class="slds-form-element">
                        <div class="slds-form-element__control">
                          <apex:inputText styleClass="slds-input" value="{!AdditionalRecipient}" label="Additional Recipient" html-placeholder="Additional Recipient" />
                        </div>
                      </div>
                  </apex:outputPanel>
              </apex:define>
       
              <apex:define name="notifications">
                  <apex:outputPanel rendered="{!HasMessages}" id="notification">
                      <div class="slds-box slds-box--x-small slds-theme--shade">
                          <apex:messages id="msgs" />
                      </div>
                  </apex:outputPanel>
              </apex:define>
       
              <apex:define name="progressBar">
                  <apex:outputPanel id="results" rendered="{!BatchJobId != null}">
                      <NUTPLX:NTFProgressBar jobId="{!BatchJobId}" fileNameString="{!OutputFilename}" templateIdString="{!NimbleTemplateReference}" isPrintJob="{!IsPrintBatch}" />
                  </apex:outputPanel>
              </apex:define>
       
              <apex:define name="templateResults">
                  <apex:outputPanel rendered="{!ListSize == 1}">
                  <div class="templateForeground">
                      <NUTPL:TemplateViewer id="NUTPLComponentSingle" templateIdArg="{!NimbleTemplateReference}" paramsArg="param1={!SelectedRecords[0].id}" />
                  </div>
                  </apex:outputPanel>
       
       
                  <apex:outputPanel rendered="{!ListSize > 1 && ListSize <= PreviewMaximum}">
                  <div class="templateForeground">
                      <NUTPL:TemplateViewer id="NUTPLComponentMultiple" templateIdArg="{!NimbleTemplateReference}" param1Arg="{!ValidatedRecordIds}" />
                  </div>
                  </apex:outputPanel>
       
                  <apex:outputPanel rendered="{!ListSize > PreviewMaximum}">
                  <div class="templateForeground">
                      <NUTPL:TemplateViewer id="NUTPLComponentBulk" templateIdArg="{!NimbleTemplateReference}" paramsArg="param1={!SelectedRecords[0].id}" />
                  </div>
                  </apex:outputPanel>
              </apex:define>
          </apex:composition>
      </apex:page>
      1. Substitute the object API name "NU__Cart__c" (on line 1) with the name of the API name of the Object the Template is based on.
      2. Substitute the class name "NTFCartController" (on line 1) with your apex class name.

Creating the List View Button

  1. From Setup, Navigate to the Object the Template is based on.
  2. Select "Buttons, Links, and Actions"
  3. Click "New Button"
  4. Label is the friendly name (in plural) of your template with spaces
  5. Name is the friendly name (in plural) of your template without spaces
  6. Description is "Button to generate Nimble Create Template Carts from the Cart List View", where you substitute "Cart" for the name of the Object the Template is based on
  7. Display Type is "List Button"
  8. Behavior is "Display in Existing Window with Sidebar"
  9. Content Source is the VisualForce page that was configured in the previous step
  10. Click Save

Adding the List View Button to a Search/List View Layout

  1. From Setup, Navigate to the Object the Template is based on.
  2. Select "Search Layouts"
  3. Edit "Cart List View", where Cart is the name of the object you are editing.
  4. Move your List Button from the step above from the "Available Buttons" section to the "Selected Buttons" section
  5. Save

Creating the Detail Page Button

  1. From Setup, Navigate to the Object the Template is based on.
  2. Select "Buttons, Links, and Actions"
  3. Click "New Button"
  4. Label is the friendly name (in singular) of your template with spaces
  5. Name is the friendly name (in singular) of your template without spaces
  6. Description is "Button to generate Nimble Create Template Cart", where you substitute "Cart" for the name of the Object the Template is based on
  7. Display Type is "Detail Page Button"
  8. Behavior is "Display in Existing Window with Sidebar"
  9. "Button or Link URL" is the VisualForce page that was configured in the previous step. In the example below, substitute "Cart" for the name of the Object the Template is based on
    1. /apex/NTFCart?Id={!NU__Cart__c.Id}
  10. Click Save

Adding the Detail Page Button to a Page Layout

  1. From Setup, Navigate to the Object the Template is based on.
  2. Select "Page Layouts"
  3. For each layout:
    1. Click Edit
    2. In the hover menu, on the left side, click "Buttons"
    3. Drag the label for your Detail Page Button from the "Available" list on to the Page Layout in the section titled "Custom Buttons".
    4. Save

Connecting Specific Nimble Create Templates to  Nimble Create Extension features

  1. Navigate to the Nimble Create Template record you are configuring
  2. There should already be a related list titled "Frames". If this is missing, you can add this by editing the page layout
  3. Create a New record.
  4. The Name is the name of the Apex Class without the 'Controller.cls' suffix, as specified in the string constant 'NIMBLE_FRAME' in that class - this needs to be otherwise identical in order for the frame to properly connect the Template to the Nimble Create Extensions additional features.

Enable Nimble Create Extensions Email Functionality

In order for images to appear within an emailed Nimble Create template, the image much be stored as a Document (not a file) record within Salesforce. The Document should have "Externally Available Image" set to TRUE. If this is not the case, when the email is received, the user will not be able to view the image within the template.


Create The Salesforce Classic Email Template

Requirements

The emailing functionality of Nimble Create Extensions is based on the NimbleUser configuration for Salesforce Email or Sendgrid Email. In order to support email you must:

  1. Complete the steps for "Supporting List Views"
  2. A Salesforce Email Template which is cut-and-paste, with a few substitutions, noted below
  3. Edit the Nimble Create Template record to include additional settings for email
  1. From Setup, Search and Navigate To "Classic Email Templates"
  2. Select the folder "Nimble Create Templates", if it exists
  3. Click "New Template"
  4. Type: "Visualforce"
  5. Folder "Nimble Create Templates"
  6. Available for Use: checked
  7. Email Template Name: The friendly name for the Nimble Create Template, with spaces
  8. Template Unique Name: The friendly name for the Nimble Create Template, without spaces
  9. Description: Uses Nimble Create to generate an email for a selected record
  10. Email subject: put 'abc' for now, this will be replaced using the source code connecting the Salesforce Classic Email Template to the Nimble Create Template
  11. Set the Recipient Type = Contact
  12. Set the Related to Type to the object that the template is based on.
  13. Click "Next"
  14. Click "Edit Template"
  15. Insert the following code as the email template and update the lines listed below:

    1. Click here to expand...
      CODE
      <messaging:emailTemplate subject="Renewal Letter" recipientType="Contact" relatedToType="NU__Cart__c">
      <messaging:htmlEmailBody >
      <NUTPL:TemplateViewer templateIdArg="a2i50000000aWo6" paramsArg="param1={!relatedTo.Id}" />
      </messaging:htmlEmailBody>
      </messaging:emailTemplate>
      1. Line 1: Specify your desired Subject Line for your email by substituting the text "Renewal Letter"

      2. Line 1: Specify the object this template is based on by substituting the text "NU__Cart__c" for the API name of the object

      3. Line 3: Specify the SFID of the Nimble Create Template by substituting the text "a2i50000000aWo6"

  16. Click Save

Test The Salesforce Classic Email Template

  1. Click the "Send Test and Verify Merge Fields" button.
  2. For Contact, enter your name or a test user with an email address that will be delivered to you.
  3. For Related Record, select a sample record you've been using to create your template
  4. Check "Send Email Preview To" and enter your email.
  5. Click OK to receive an email copy of the preview.

Setting Email Configuration On The Nimble Create Template

  1. Navigate to the Nimble Create Template record you are configuring
  2. In the section titled "Email Configuration" fill in each of the following fields:
    1. Email From
    2. Email To
    3. Email Recipient Fields
    4. Preview Maximum
    5. Email Template Name
    6. SObject API Name

      If all of these fields are not populated, or are populated incorrectly, an error will be received upon attempts to email constituents.

Email Field Details

Field

Further Details

Email FromThis is what will display on the "From" line of all emails. You specify this by configuring an "Organization Wide Email Address" in the setup menu. Then paste the SFID of that record here.
Email ToThis is a contact who will receive all emails as a CC. Generally this is the contact named "Invoice Recipient", and NimbleUser has probably already set this up for you. The need to send a CC for all emails is a requirement of Salesforce.
Email Recipient FieldsThese are the email addresses that are unique to each email. You specify one or more fields from your object. The screen shot above shows fields that are available to the NU__Order__c object. If you are unsure of which fields to place here, contact a NimbleUser consultant or support representative.
Preview MaximumThis is the number of records to display to the screen preview when you select records to print or email. If you set the value to 5, and you run the template for 4 records, you will see all 4 records to the screen. If you set the value to 5 and you run the template for 200 records, only 1 record will be shown in preview. This allows the preview to work efficiently by not showing too many records than necessary. When you print or email all 200 records will be delivered. Set the "preview maximum" to any number of your choosing. If you select a large number and get error messages about "view state", "101 SOQL Limit", or "Execution timeout" then reduce this number. The default number for this field is 25.
Email Template NameThis is the Email Template you authored in the prior step. An email template allows you to specify the Subject Line of your email.
SObject API nameThis is the API Name of the object your template is based on. It should match the SOQL Query "FROM" line.

Sending the Email from an Automated Process

  1. From Setup, Search and Navigate to "Email Alerts"
  2. Click "New Email Alert"
  3. Enter a description and unique name
  4. Set Object to the object type the template is based on
  5. Set Email Template to the Nimble Create Template you want to use for the email
  6. Set the recipient(s) for the email
    1. If the recipient address is dependent on a field, choose 'Email Field' from the dropdown
    2. If the recipient address is static, choose the recipient using the appropriate value from the dropdown
  7. Optionally fill in the Additional Emails box
  8. Set the "From Email Address" to the address you want the email to come from
  9. Save
  10. Add the email to your automation when required.
    1. These will be used in the following examples:
      1. Flows
      2. Process Builders
      3. Workflow Rules
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.