Author Archive

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.
  2. Open Document Action that you just created and copy the Button/Link Code generated to clipboard. If you are using Lightning Experience, see this Setup LEX article instead for more detail.
  3. Standard Object. To create the Button or Link on a standard object you need to select: Setup (1) ->Customize (2)->”Specific Object”(3)->Buttons, Links, and Actions(4) ->New Button or Link (5).
    ButtonLink
  4. Custom Object. To create the Button or Link on a Custom object you need to select: Setup (1) ->Create (2)->Objects (3)->”Select specific object” ->Buttons, Links and Actions (4).
    CustomObject-Button
  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 button or 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 field that you saved to clipboard from previous steps.
    5. Click “Save”.
  7. Add the button or link to the page layout.
    1. Go to Setup -> Customize -> Select Object ->Page Layouts -> Select the layout you want to add the Button or Link to and click “Edit”.
    2. Select “Button” or “Custom Links” in the menu.
      Screen Shot 2015-03-22 at 3.58.40 PM
    3. Find newly created button or link.
    4. Drag your button to the Custom Buttons area or if it’s link into Custom Links area.
    5. Click “Save”.
    6. NOTE: If using Lightning Experience, you will need to go to “Salesforce 1 & Lightning Actions” related list when modifying your page layout and also drag the action button onto layout from there if you would like it visible next to drop down of standard buttons.
  8. Now you are ready to use the App!
  9. Open a record that you want to send test from and click the button.
  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 instead of Notes & Attachments or create a Document.
  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).
  15. 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.
  16. 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. 

Document Action

  1. Open your Salesforce and create a new Document Action.
  2. Document Action custom object will be installed in your org as soon as the package completed installation.
    1. You can access it in two ways: via selecting from All Tabs menu or via RS Documents App.
    2. To access All Tabs menu click “+” on your tab menu and select Document Action from the list of available tabs:RS Document Action Tab
    3. To access from RS Documents App switch app to “RS Documents App” from the top right corner, then select Document Actions tab from the tab menu:
      App

      DocumentActionTab
  3. After selecting “Document Actions” tab click  “New” button to create a new Document Action:

    NewDocumentAction

 

Section ‘Document Action Detail’ (Top Section): 

  • 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 RS 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:
        InvoiceAPI
  • 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.”
  • Template Document ID: paste Google Docs document ID that you have saved from the previous step.
  • 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:Screen Shot 2015-02-18 at 3.01.11 PM
    • 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)

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 DO have a Google Apps For Work account, then go to Setup > Develop > Custom Settings > Click ‘Manage’ next to Google Apps Domain Setting. If you have a previously set “Company_Domain” setting, then check that it has your company domain in the Value field (which should match your Google Drive domain). If you need to create a new one, the name should be “Company_Domain” and the value will be the last part of your company email address that comes after the “@” symbol. For example take, support@ramseysolutions.com email, the value would be “ramseysolutions.com.” You will not be able to save the “company” setting inside document action before you do this step.
      • If you do NOT have a Google Apps For Work account, then you can either sign up for one, or just use the “Visibility: Link” setting instead, and make sure to specify a value for “Save URL to Salesforce Field”. This will allow anyone in your company who goes to that Salesforce record, to still be able to click on the URL link and go directly to the document. In addition, you can also use the “Save URL to Salesforce Field” link in any email templates that you create. You could then use that email template as an alternate means to send your merged Google Drive document to a list of users in your company.
      • NOTE: If you try to merge a document with “Visibility” set to “Company” and the Google Drive account you used to authenticate isn’t a company account, you’ll receive the alert, “Error while sharing document. Error message: Permission not found”.
    • Link – This is the most popular option that most app customers use. 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.
    • 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).
    • Copy the API name of the newly created field and paste it in the Document Action settings.
      DocAPI


Section “Properties of Merged Document in Salesforce:” 

  • Attach file to record. This field is not required. 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, go Setup > App Setup > Develop > Custom Settings > Click on ‘RS Documents’ link > Click on ‘Manage’ next to RS Documents Settings > Click ‘Edit’ >  Check box to ‘Use Files’ checkbox and click ‘Save.’ You can then modify your object page layout to pull the ‘Files’ related list onto layout to access generated files from each record.
    • To use Salesforce ‘Documents’ instead of Attachments or Files,  go to Setup > App Setup > Develop > Custom Settings > Click on ‘RS Documents’ link > Click on ‘Manage’ next to RS Documents Settings > Click ‘Edit’ > Check box to ‘Use Documents’ and click ‘Save.’
      • 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.
  • 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.

Section “Email:”

  • This entire section is optional.  Allows you to automatically/manually send newly generated document to the predefined Lead or Contact.
  • 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 or Contact ID that will be pulled from each object record you generate the document from. You will build this merge field within the custom button code screen (see “HELP” text below email section in document action and click on the “HERE” button to bring you to custom button where you can find the base object relationship to the Lead or Contact ID field). The merge field code should always include “ID” towards the end so you know you are merging the correct one.
    • 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:
      ContactID
  • 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.
  • 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. ID of the template that will be used in the email message (you can find directions on how to create and manage 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“):
      Email Template ID

 Section “eSignature:”

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

“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:

  • Button/Link Code. Code for the Button or Link that will be used for Document generation (copy this value to your clipboard, you will need it in the next step). In addition you can manually setup what Salesforce fields to update upon Document Generation by adding in the end of this code 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

 

ButtonCode

Install and Configure the App

Create Google Account

RS Documents is using Google Docs functionality for managing merged document templates. We chose this platform for our app because we think Google Docs is the most modern and efficient platform for managing your documents in the cloud. It’s extremely simple to adapt as it has most of the features Microsoft Office Word has to offer. You have to setup your Google account to access your Google Drive where you can create or upload your content prior to installing RS Documents app. You can learn more about Google Docs here.


 

Install and Configure the App from App Exchange

  1. Go to the AppExchange profile for RS Documents to install the app into your Salesforce org.
  2. Click the Get It Now green button.
    Screen Shot 2015-01-20 at 2.35.42 PM
  3. Follow the steps prompted to install the package in Production or Sandbox org.
    1. After you click to install, you will be prompted to check box to “grant access” to the following Third-Party access by Google to use RS Documents app:

 


 Authorize Your Google Drive Account to RS Documents

  1. Click on ‘RS Documents Configuration’ tab after selecting “RS Documents” from your app window or by clicking on the more tabs (+) symbol at top.
    1. If using Lighting Experience, please refer to this article for more detail on initial setup.
  2. Authorize the App with Google account you would like to use with RS Documents (can be a free gmail/google drive account to register or you can use a G Drive/Company drive) .
    1. NOTE: Each RS Documents user will have to authorize their own google drive in order to use the app or if you would like 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” RS Documents to access to your Google Drive:

Permissions

After you checked out a trial and ready to move forward and take your process live for your company, make sure to check the following Permissions, as sometimes this can cause confusion or errors while using the app:

  1. Check if you have a license assigned to your user for RS Documents and make sure RS Documents license is active.
  2. Check if you have access to the RS Documents app components: Visualforce page, Apex Classes, Triggers, Documents Action object.
  3. Make sure you authorized access to the App via All Tabs(+) -> RS Documents Configuration.
    1. Make sure you are logged into a single Google account when you authorize the app.
  4. Make sure that you logged in into correct Google account in your browser. And you are not logged into any other Google accounts at the same time.
  5. Make sure you have access to any fields that the Document Action is trying to update like a URL text field that will get populated with Google Doc link.
  6. Make sure you have access to edit the record/object that you are performing the Document Action on.
  7. Do you have Read access to the Google Doc template used in the document action.  Click on Document Action, then Edit Template and make sure you can at least see it.
  8. If you are saving the new document to a Google Folder as indicated in the Document Action, do you have EDIT access to that folder.  You can copy the folder ID on the Document Action record and paste it into the url after “https://drive.google.com/drive/u/0/folders/“ to verify.  And try to add a document to this folder to make sure you have permission to create a document in the folder.
  9. If you are sharing the new document to something other than Private, do you have the ability to share your Google Docs in the same way as indicated in the Document Action. Some companies have their security settings at the admin level that do not allow their users to share any Google Docs publicly meaning “Anyone with the link.”  Usually it would say “Anyone with the link at your company can view.”  If you can’t share to anyone with the link, then you can’t set Document Action to share with anyone with the link.  Or Public as an example.  You can change your admin level security to accommodate this if needed.

Activate RS Documents License and Assign/Add Users

  1. If you installed the RS Documents app trial and are ready to activate your licenses follow these steps.
  2. Login to AppExchange and click your name in the top right, then My Account.
  3. It will show all the apps you have installed. Click the Buy Now button under the RS Documents app.
  4. Follow the steps to purchase the number of licenses you wish to purchase.
  5. To assign licenses purchased to your Salesforce Users, go to your Salesforce, then to Setup, and Installed Packages.
  6. Click “Manage Licenses” link next to the RS Documents package.
  7. Add and remove users to the app to manage the licenses available.
  8. You can always return to AppExchange area to buy more licenses or less licenses.

Demo video

The video below will give you a quick overview of how to configure and use the app.  A great starting point to just get a general overview of the basics of the app.