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
  4. Fill out the fields following this guidance:
  • Action Name: reference name of the action you wish to setup (e.g. “Generate Quote”, “Download Contract”, “Email and Download Invoice” etc.)
  • Template Document ID: paste Google Docs document ID that you have saved from the previous step.
  • Folder ID: This field is not required. Enter ID of the Google Drive folder where generated document will be saved (if you wish to specify this). 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
    • 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)
  • 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.
    • If you plan to set visibility setting to “Company,” you will need to do these additional steps:
      1. Specify your Company domain in Salesforce domain setting if users would like to share generated documents with their own company.
      2. Go to Setup  -> Develop -> Custom Settings -> Click “Manage” in front of “Google Apps Domain”.
      3. Click “Edit” in front of “Company_Domain”.
      4. Enter your company domain name in the “Value” field and click “Save”.
  • 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.
  • Output format. This field is not required. 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
  • 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
  • Save in Field. This field is not required to fill out. However, completing this field will allow you to save the link to the generated document to the Base Object 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 “Email” – 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.
    • To do this you should first create an Organization-Wide Email Address: Go to Setup–>Email Administration –> Organization-Wide Addresses.
    • Click Add and set the Name and Email address and permission.
    • If you only allowing certain profiles to use the address, make sure these are the same profiles as assigned to users that will be using RS Documents apps.
    • Click “Save”. The email address has to be verified now. Verification link is sent to that email and you need to open and click the link to activate it.
    • Then from the list of Organization-Wide Addresses locate the one you just created and click “Edit”.
    • In URL at the top locate Salesforce ID and copy it. Salesforce ID will be after “salesforce.com/” and before “/e”. For example: In URL https://na30.salesforce.com/0D2360000008Qkk/e Salesforce ID is be 0D2360000008Qkk
    • Paste Org-Wide Address Salesforce Id into Document Action field Email From Org Wide Address.
  • 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

 

Click “Save” to save your Document action. A completed Document Action will auto-generate Action ID and Button/Link Code

  • Action ID. Auto-numbered ID generated for Document Action identification.
  • 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