Basic Configuration: Getting Started

Contents of Basic Configuration for Getting Started:

  1. Install the App from App Exchange
  2. Authorize the App with Google Drive
  3. Create Google Docs File
  4. Create Document Action
  5. Create Button for Document Generation
  6. Execute Any Document Button

 



Install the App from AppExchange 

  • Go to the AppExchange profile for A5 Documents and click the “Get It Now” green button.
  • Follow the steps prompted to install the package in Production or Sandbox org.
  • After you click to install, you will be prompted to grant third-party access to several  Google websites in order to use the A5 Documents app. Click yes to authorize.



Authorize Your Google Account with A5 Documents

      1. Click on ‘DocGen Configuration‘ tab after selecting “A5 Documents” from your app launcher window or by clicking on the more tabs (+) symbol at top.
      2. Authorize the App with Google account you would like to use with A5 Documents by clicking the blue “Grant Access” button.
        1. You will be prompted to select a Google Drive account to use. If you don’t have a google drive account already, you have option to create a free gmail/google drive account to register or you can use a G Drive/Company drive) . You have to setup your Google account to access your Google Drive where you can create or upload your content prior to authorizing A5 Documents app.
        2. NOTE: Each A5 Documents user will have to authorize the app with their own Google Drive account in order to use the app and generate documents. Or there is an option to authorize One Google Drive account for all your Salesforce users to use when generating documents, see this article for more detail.
      3. You will be prompted to “allow” A5 Documents to access to your Google Drive:


Create a Google Doc

      1. A5 Documents app uses Google Docs to create templates with Salesforce merge data. You can learn more about Google Docs here.
      2. Login in to your Google Drive if not already  and click “New” button and select Google Docs.
      3. Or go directly to Google Docs. Click “+” in the bottom right corner.
      4. You can also upload an existing Word document template to your Google Drive and and modify your template from there in Google Docs. You can review this article if you would like more details on how to transition your Word or PDF template to Google Docs.
      5. Once you have your Google Doc template, make sure to give it a title in top left corner. We also suggest that you put at least one merge field into title of document (this can be added later when building your template inside Salesforce) so that it merges a unique filename from each Salesforce record.
        NOTEYou will be able to edit,  format, and add merge fields onto the template directly in the template builder inside document action later following this article.
      6. Save the Google Doc document ID to clipboard (or keep in open in a separate tab, you will need it in next step):-The Google Doc ID is listed in Google Doc URL after “document/d/” and before closing “/” (do not include “/” in the beginning and in the end)
        Example below, Google Doc ID in red:
        https://docs.google.com/a/ramseysolutions.com/document/d/19Bgd3kqLq85VABpB1_0Ft0XULH8ddDEw_NjT7RK_0ws/edit
      7. Set access to the template document. Settings should reflect the desired level of access you wish to give people in your company:
        1. By default the access level will be set to “Private – Only you can access”. You can keep the setting as private if you are the only person who needs to have access to the template and generate documents. If others need to be able to access the template to generate documents, you can click the blue “Share”  button on the top right to  select which individual users or group(s) may access to the document and what type of access they have  (can “edit,” can “comment,” or “can view”).                                 
        2. If you want to open up sharing access to your “company” rather than individual users, you can click blue link “change link to XXX company” (screenshot below is showing as A5 Apps as that is our company drive name but it will show your company name when updating sharing settings).
        3. If you want users outside your company drive or with different Google Drive user accounts to be able to access the template, you can update the sharing access for “anyone with the link” and decide the type of access level they have to document (can “edit,” can “comment,” or “can view”). Anyone who has the full link can access the document without signing into Google Drive. Other users will be able to access the Google Doc template within Document Action.

          1. NOTE: If you do not see “Anyone with the link” as an option for sharing/permission setting, then you may have some strict sharing settings setup on your company Google Drive.The Super Admin of your drive will need to alter the settings to be able to generate documents with our app. See this article for more detail.
      8. Now that you have updated the sharing permissions on the Google Doc template, you are ready to continue to the next section, which will guide you through the steps to create a Document Action. Once the Document Action is created, you’ll be able to use the Document Action embedded template builder to customize your Google Doc template with Salesforce merge data, as mentioned in this article.

 


Create Document Action 

  1. Open your Salesforce to create a new Document Action.
  2. The Document Action custom object will be installed in your org as soon as the package completes installation.
    1. You can access it in two ways: via selecting from All Tabs menu (+ symbol from all tabs) or via A5 Documents App app launcher if using Lightning experience.
    2. Select Document Action from the list of available tabs:
  3. After selecting “Document Actions” tab click  “New” button in top right corner to create a new Document Action:

Overview: Document Action Sections and Fields

Top Section: ‘Document Action Detail’

  • Action ID: Auto-numbered ID generated for Document Action identification.
  • Action Name: reference name of the action you wish to setup (e.g. “Generate Quote”, “Download Contract”, “Email and Download Invoice” etc.)
  • Base object API. Provide the API name of the Object where the A5 Documents App will be used (e.g. if you are generating invoice with the data merged from Opportunity, then you should put “Opportunity” into Base Object API field)
    • API names for standard Salesforce object are listed here (refer to blue underlined object names). Typically it will be exact name of the object with no space, like: Lead, Account, Contact, Opportunity, Case etc.
    • To access API names for custom object go to Setup, under App Setup on the left toolbar click “Create”, select  “Manage your custom objects” function or “Objects” (if expanded from the toolbar).
      • Find a custom object and click on it.
      • You will find an API Name field in Custom Object Definition Detail page (see example below for Opportunity API name to use for base object in document action).

  • Field to Update & Field to Update To: This field is not required. Purpose of this field is to automatically update a picklist status to another status value on the object record you generate document from. For example you have a standard picklist field on Opportunity” object called ‘Stage’ which shows which stage the Opportunity is at. You could have a the Opportunity record be in picklist status “Quote Requested” and then once you generated document on this record, you could automatically update this field status to “Quote Sent.”
    • NOTE: When using the update field feature of document action, please be aware this action will be performed last during document generation process. However keep in mind if using email preview feature in document action, the field update will still execute right before redirecting to the email preview page. And it is up to the user to decide to click send on the email or cancel (if you click cancel on email preview screen and do not send the email, the field update will still be executed/updated on the related record).
  • Template Document ID: paste Google Docs document ID that you have saved from step 6 of previous step, Create Google Docs File.
  • Folder ID: This field is not required. If you would like all generated documents from this document action to be placed inside a folder on Google Drive, enter ID of the Google Drive folder where generated document will be saved (make sure folder has open access to the app users generating documents there). If you leave this field blank, the generated document will be saved in the same folder where Google Docs template is located.
    • You can find Google Drive folder ID  by clicking on the folder in your Google Drive and copying ID value from the URL.
    • For example, if the URL of google drive folder is the following: https://drive.google.com/drive/u/1/folders/1MPtyLoDi9FrH6Nkt-OIbaL4AEvAnJ-uI, the Google Dive folder ID is after the last / so would be 1MPtyLoDi9FrH6Nkt-OIbaL4AEvAnJ-uI. See example screenshot below for folder ID.
    • Optional Advanced Configuration for Google Drive Folder ID: You also have the option to dynamically pass the Google Docs folder ID in custom button URL so generated document goes directly to Google Docs folder: Take the button code from Document Action to paste into custom button and then add: &folderId={folder id field} at the end of the custom URL. Example: https://rsdoc.na10.visual.force.com/apex/GenerateDocument?id=a02F000000RKLsz&templateId=GDT-000476&attach=true&output=pdf&emailAction=Autosend&emailTo=003F000002FuH0P&emailTemplate=00XF0000001jK8U&emailToAdditional=mpavluchenko%40sclode.com&folderId=0BxNC7wi8NG3hRzZRTEltT3NZTkE  (****notice &folderId=0BxNC7wi8NG3hRzZRTEltT3NZTkE)

Top-Middle Section: ‘Properties of Merged Document in Google Drive’

  • Visibility. Set up the visibility options for the document you are going to generate. Options are the same as standard Google Docs sharing setting options: Private, Company, Link, Public:
    • Private – Only you can access. If you are the only user to generate documents and using the app, then you can use this setting. If anyone else tries to generate a document with this setting or access your generated document, they will not be able too.
    • Company – You can choose this option only if you have a Google Apps For Work /G Suite for your company. Setting “Visibility” field to “Company” will allow any users in your company to have automatic access to the merged document from the “Shared with Me” folder in their Google Drive accounts.
      • If you getting any error message or having issues with Google Apps for Work, you can review this article for more detail.
    • Link – This option allows “anyone with the link” to access the generated documents if they have the full google doc link, example: “https://docs.google.com/document/d/1xl9QO-IDDGYoJ6CwJ6G-2UU5Kuz9omCsFdFbP-zV5sg/edit” sent to them via email and can access the generated document from the Google Doc URL link on Salesforce record.
      • No sign-in to google drive required and other users will be able to access the google doc template within document action.
    • Public –  Choosing this option means that anyone will be able to access your generated documents.
  • Access. Set up the access restrictions options for the Document you are going to generate. Options are the same as standard Google Docs access options: Can View, Can Comment, Can Edit.
  • Save URL to Salesforce Field. This field is not required to fill out. However, completing this field will allow you to save the URL to the generated document to the Base Object page layout.
    • Create a custom field on the Base Object. (find steps on how to create custom fields on Standard vs Custom objects here).
    • Use field type “Text” (link will be saved as a string of text, you will have to copy and paste it into your browser to access) or “URL” (link will be saved as a URL link and will be clickable directly from the layout. If you would like example steps to create this URL field, you can review this article).
      • If you are looking for an example formula that gets the google doc ID out of the full URL, you can review this article.
    • Copy the API name of the newly created field and paste it in the Document Action settings.
  • Redirect To. Configure where will the process redirect after generating document and executing other actions. Can be used only for manual document generation—using custom button. Defaults to Record.
    • None – If selected, default option will be used (Record).
    • Record – Default option. Redirects to the record from which the process was invoked.
    • Google Doc – Redirects to the google doc which was generated.
    • Custom URL – You can specify a custom URL where you want to redirect.
  • Custom Redirect URL. If you select Custom URL in Redirect To field, this is where you specify the custom URL where the process will redirect at the end. It can be any publicly accessible URL, e.g. http://google.com.


Middle Section: ‘Properties of Merged Document in Salesforce’

  • Attach file to record. This field is not required unless you are using email feature to send the document within document action. If you check this box, a copy of the generated document will be attached to your Salesforce record. Standard is for the generated document to create an ‘attachment’ and show under your Notes & Attachments related list on object layout. Should you prefer the generate a ‘File’ or a ‘Document’ instead of ‘attachment,’ you can configure this in your custom settings under Setup:
    • To use Salesforce ‘Files’ instead of Attachments, see this article for steps.
    • To use Salesforce ‘Documents’ instead of Attachments or Files, see this article for steps.
      • When using ‘documents,’ the copy of generated document will go to your Documents tab (go to + sign for more tabs). You will not see the generated document go under your record like using Attachments or Files as it is not a related list.
      • If you would like to specify a folder for the generated documents to go into under Documents, click to modify Document Action page layout and add the custom field ‘Documents Folder’ to the layout (suggested placement next to Google Doc ID/Folder ID in top section). Then paste your ‘Document Unique Name’ into this field on document action. The unique name will look like an API name with no spaces, example “Opportunity_Generated_Quotes.”
    • It is possible to generate an attachment and a file. Or a file and a document. Or all three if you wanted, just modify the custom settings per the instructions above to have additional box checked.
  • Output format. This field is required if you check field box above to “attach file to record.” If this parameter is provided, new document gets downloaded in the output format and attached to the Salesforce record. Supported outputs are:
  1. .docx
  2. .html
  3. .odt
  4. .pdf
  5. .rtf
  6. .txt
  • Download File. This field is not required. If you check this box, a copy of the generated document will go to your ‘downloads’ folder on your computer.
    • NOTE: It is mandatory that you allow Pop Ups from Salesforce domain as browsers are interpreting this “download” action as a popup in new window. If you are’t sure if your pop ups are already approved, you will notice that when you attempt to generate a document for download to your computer, there is usually an indication that a pop up was blocked and you have the option to approve that URL for the future. Once the URL is approved, you should not have to do this step again.
    • NOTE: You cannot use this feature with “auto delete google doc” feature. See more details and restrictions of this Download feature in this article.
  • Preview Document Step Enabled. This field is not required. If you check this box, you will be able to preview the generated document before sending the document by email. Once you click custom button to generate a document, a preview screen with generated document will show on your screen and you can review to ensure looks good (you cannot edit the generated document from this preview screen). If looks good, you can click blue “Continue” button to send for email. If the document does not look ready to go, you can click red “cancel” button and the generated document will be deleted and not sent to recipient. Then you can modify the record or template before generating the document once again.
    Example figure below showing preview of document screen:
  • Delete Google Doc After Merge. This field is not required. If you check this box, the copy of generated document will automatically get deleted from your google drive. If you do not check this box, a copy of the generated document will go to your google drive each time you generate a document.
    • NOTE: You cannot check this box to delete google doc if you have box checked to “Download file.” Both features do not work together so you have to use individually in document action.
    • NOTE: You also cannot check this box to delete google doc if you have box checked to “Save URL to Salesforce” field in document action. You wouldn’t be able to access the google doc URL from record if you deleted it so both features do not work together.
    • NOTE: If using the A5 Documents app with A5 Signature app, you cannot check this box to auto delete google doc after merge as you need the document to exist to send for eSignature.

Lower-Middle Section: ‘Email’

This entire section is optional.  This section allows you to automatically/manually send newly generated document to the predefined Lead or Contact from base object record. Make sure activities is enabled for custom objects if emailing.

  • Email Action.
    • Select  “Autosend” if you would like to automatically send out an email with attached document.
    • Select  “Preview” if you would like to preview your email before sending.
  • Email To.
    • Create a merge field to the Lead Id or Contact Id that will be pulled from each object record you generate the document from.
      • You can review this article for more detail on using the “email to” field with custom button or with automation method.
    • API name of the field you want to merge should be used for this, for both standard and custom fields.
    • With installed package, we have included custom lookup field to Contact from Opportunity for primary contact called “Primary Contact” with API name rsdoc__Primary_Contact__c. If you want to use it in “Email To” field, the format would be {Opportunity.rsdoc__Primary_Contact__c}. For more information about configuring this field, you can look up the Email Help section on the Document Action record.
    • You can also enter Lead or Contact ID of the recipient if it’s always the same person that you want to email generated document too. You can find the ID in the URL of the Contact/Lead record. For example if the URL of contact record is “https://na46.salesforce.com/0030H00005Fl5uf,” the contact ID would be the part in bold “0030H00005Fl5uf.” See below screenshot for visual example.
    • NOTE: If you are looking to use the Email To from an object that is not Lead or Contact, you can review this article.
  • Email To Additional and Email CC and Email BCC. Fields used to specify additional email addresses that will be put into “To”, “CC” or “BCC” fields of the email. Enter email addresses separated by comma.
    • You can also merge an email field or text field (that contains an email) into document action to merge the email field from base object into email with generated document. You would use the format to create merge field as you do with “email to field.” For example, if you have an email field on Opportunity that is for “billing contact,” example merge field to put in document action in one of these additional email fields may be {!Opportunity.Billing_Email__c}.
  • Email From Org Wide Address. Optionally you can set default email address that you want the email to be sent from. See this article for more detail and steps to set this feature up.
  • Email Template (Classic only). ID of the template that will be used in the email message (you can find directions on how to create and manage Classic email templates in Salesforce here).
    • You can find the email template ID in the URL of the template (NOTE: The email template ID will always start with the letters “OOX“ when using Classic version or have some additional characters before OOX in ID if using LEX).

Additional Notes:

  • Email Spam: If you have any issues with email going into spam folder when sending generated document, you can review this article for more detail.
  • Number of Email Retries: If you want to modify the number of retries for document generation email attempt, you can review this article for more detail.

 Lower Section: ‘eSignature

This section is only to be used if combining automation with our A5 Signature app to send generated document for eSignature. If you are sending generated document for eSignature, you can see step by step documentation in this article: “Using A5 Documents with A5 Signature for Full Automation”.

“Save” your Document Action to Generate Custom Code: 
Once you have completed all needed fields in document action, click “Save” to save your Document action. A completed Document Action will auto-generate Action ID and Button/Link Code and you can continue to  next section below to create your custom button.

Example document action code displayed once saved: 

  • Once you have copied the button/link code, you will paste into your custom button under the Base Object API being used in Document Action following steps in section below to Create button for document generation.
  • Execute Any Document Action Button: This feature will allow you to have one button with picklist of different templates on your base object page layout and can default a group of templates within a custom button. More detail of this feature in Execute Any Document Button at bottom of this article.


Create button for document generation

  1. To initiate document generation you need to create a button or link that you can add to the layout of the object you will be sending a document from. This button will allow you to execute a single document action template from base object. If you would like to create one button to execute any document action template from same base object, you can review next section for “Execute Any Document Button.”
  2. To create your button for document generation for single template: Open Document Action that you just created and copy the Button/Link Code generated to clipboard.
  3. Go to Setup > Object Manager >  Find object that you are using as base object in document action (example Opportunity) > go to “Buttons, Links, and Actions” related list.
  4. Click “New Button or Link”
  5. To learn more on how to create a button or link check out this Salesforce Help article.
  6. In the Button/Link creation menu:
    1. Enter the label of your button or link (e.g. Generate Quote).
    2. Choose whether it will be a Detail Page Button or Detail Page link.
    3. Select behavior “Display in Existing Window with Sidebar.”
    4. Leave the Content Source as “URL”, and copy and paste into the Editor box the value from the Button/Link code in document action that you saved to clipboard from previous steps.
      Example custom button shown below using Detail Page Button:
    5. Click “Save”.
    6. Optionally you can manually setup what Salesforce fields to update upon Document Generation by adding in the end of this document action code in your custom button for next variables: &fieldtoupdate1=StageName&fieldtoupdatevalue1=Proposal Sent, where:
      • &fieldtoupdate1= API Name of the field that you want to update (Opportunity stage in our Example)
      • &fieldtoupdatevalue1=New value of the field (In our example new value will be “Proposal Sent”)
      • Put  consequential  after variable if you want to update more than one field: &fieldtoupdate1=API_Field1&fiedtoupdatevalue1=Field1_NewVale….&fieldtoupdateN=API_FieldN&fiedtoupdatevalueN=FieldN_NewVale*field to update cannot be used with boolean fields, like checkbox
  7. Add the button or link to the page layout.
    1. Setup > Object Manager >  Go to related object that you are using as base object in document action (example Opportunity object) > go to “Page Layouts” related list and click on related page layout.
    2. To add custom button or link to Object page layout:
      1. For custom button: Go to Mobile & Lightning Actions related list from Page Layout and find the custom button you just created and drag it onto page layout in section for “Salesforce Mobile and Lightning Experience Actions.” When dragging the button, the correct area will highlight green so you know you are adding it in the right place. And click save.
        Steps above shown in example image below:
      2. For custom link: Go to Custom Links related list from Page Layout and find the custom link you just created and drag it onto page layout in section for “Custom Links.” When dragging the link, the correct area will highlight green so you know you are adding it in the right place. And click save.
      3. If you also want custom button visible in Classic: Go to “Buttons” related list from Page layout and then drag the same button created into the “Object Detail” next to other standard and custom buttons (this section is below the “Salesforce Mobile and Lightning Experience Actions” in page layout). When dragging the button, the correct area will highlight green so you know you are adding it in the right place. And click save.
  8. After you have your custom button or link added to page layout, now you’re ready to build your google doc template with Salesforce merge data. Check out the articles in our “Template Configuration” category, starting with this article: Merge Fields into Google Docs Template.
  9. If you would like to test your custom button once added to object page layout, you can open a record from base object that you want to send test from and click the button or custom link.
  10. Button will redirect you to the page with the Status information of your Document Generation process.
  11. If you set to email with preview in the Document Action, you will be shown a preview of the email with attached document.
  12. Click “Send Email” and the Document will be sent to the recipients specified in the Document Action.
  13. Generated Document will be attached to Salesforce record under “Notes & Attachments” section and the link to Google Doc will be populated in the field specified in the Document Action.
    1. Optional Feature: You can also modify your custom settings to generate a File or create a Document instead of Notes & Attachments.
  14. The Document will also be available in the Google Drive folder you specified in the Document Action (Optional Feature: You can also check the box in document action to “delete google doc after merge” if you would like the copy to be deleted from  your google drive after generation as mentioned above).
  15. Important: After you configured the button or link to generate your documents, remember every time you make changes to Document Action record, you have to copy the new Button/Link Code and update your button, link, or formula, as the changes will not be passed to your button, link, or formula automatically. 
  16. Advanced Configuration: If interested in placing your custom button on a list view to mass generate documents from an object, see this article for more detail.

 



Execute Any Document Button

This optional feature allows you to create a button in Lightning to allow a user to click and select any document action for the same base object without creating a custom button for each document action. You can also assign certain document action templates to a group so you can easily find templates from a certain group. To set up this feature:

  • Create a custom button on your base object. For example, call it “Execute Any Doc Action”.
  • Select Detail Page Button or Detail Page Link as Display Type, and URL as Content Source.
  • Paste the following URL in the box: “/lightning/cmp/rsdoc__GenerateDocumentAura?c__id={!BaseObject.Id}&c__group=Group Name“.
  • You will replace the BaseObject with your base object being used in document action. For example if using Opportunity, your final code would be: “/lightning/cmp/rsdoc__GenerateDocumentAura?c__id={!Opportunity.Id}&c__group=Group Name”. 
  • Defining the Group Name parameter (c__group=) in your button code is optional though it can be used to provide a default group/filter for the available document action templates. Default values for groups are Group 1, Group 2, and Group 3, but you can rename, add, or delete values as you want by finding and editing it in Object Manager. The example button code below shows button code for base object Opportunity and default Group set to Group 2. 
  • If you do not want to specify a group in the action button, example code using Opportunity as base object would be: “/lightning/cmp/rsdoc__GenerateDocumentAura?c__id={!Opportunity.Id}” as shown in example image below:                                            
  • To change Group Name go to Setup > Object Manager > Document Action object > Values > click edit next to one of the Group Names. You can choose to make the Group name value as the default for the master picklist or leave unchecked.

  • This custom Group name will show as an available option in the “Select a Group” list.

  • Once you create the button, add it to the Base object page layout.
    • Navigate to Setup > Object Manager >Lightning & Quick Actions related list on left side > Drag the custom button you created to layout under “Salesforce Mobile and Lightning Experience Actions.”
  • For each Document Action, you can save a value in the Group field on each document action to group the document actions based on a condition of your choice.

  • To use the button, go to the base object record in Lightning experience. Click on the custom button you created. You may optionally choose to filter the list by Group using the “Select a Group” feature or you can simply select a template from the “Select a Document Action” drop down list. If you have not assigned a Document Action to a specific Group, you would find that Document Action in the unfiltered “Select a Document Action” list.

  • Once you select the Document Action you would like to execute, a document will be generated with related document actions and template.

 

Was This Article Helpful?

Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *