Attachments Setup

Prerequisites

Basics

  • Attachments are reports, images, and other files added to a record.

  • Reports always go to Notes and Attachments.

  • Images and other files can be set to sync or not sync to mobile devices.These files can sync over either the Chatter API or the Files API.

    Choose to set up one or the other.Do not set up both.

    Attachments via the Chatter API continues to work, but this option will be deprecated soon.

  • By default, images and other files sync from mobile using Chatter API.

  • The Chatter API allows for custom fields for use with attachments.Currently, the Files API does not.

  • Orgs with Lightning Experience enabled can continue to use Chatter API, but LiquidFrameworks, Inc. recommends that they consider switching to use the Files API for file attachments instead.

Setting Up Attachments Using the Files API

The Files API integration for Attachments does not allow for Custom Fields for attachments.

If you need Custom Fields on attachments, follow the Chatter API setup instructions instead (see below).

Add a Means to Display Files to Record Pages or Page Layouts

There are three ways to display Files API files in FieldFX Back Office:

  1. Add the fxl_file_viewer Lightning Component to a Lightning Record Page.

    This is the preferred method for interacting with Files API files in FIeldFX Back Office.
  2. Add a Files API Related List to a Lightning Record Page or Page Layout

  3. Add a Visualforce Section on a Page Layout

Use the FXL File Viewer Lightning Component to Jobs and Tickets

Example ofthe fxl_file_viewer Lighthing Component on a page

Add the FXL FIle Viewer Lightning component to desired record pages.

The Lightning component only works on Jobs and Tickets.

This component does not require any settings.
  1. Go to Setup → Object Manager

  2. Select the object whose pages you wish to add the fxl_file_viewer component to

  3. Select Lightning Record Pages

  4. Select the page to modify

  5. Select Edit or Clone

  6. In the page builder, navigate to the section or tab where you want the files to display

    You can also create a new section or tab using the page builder tools
  7. On the left side of the screen in the Components tab, type file in the Search field, then drag the fxl_file_viewer component to the desired location on the page

  8. Save and Activate the page for the desired users

  9. Repeat for other Lightning Record Pages and other Objects as needed

Example of a Related List of Files
  1. Add Files to the Related Lists on page layouts for Jobs, Tickets, and any other objects for which you want to use the Files API for attachments.

    Only files attached to Jobs and Tickets can sync to mobile devices.

    1. Go to Setup → Object Manager

    2. Select the object whose pages you wish to add a Files related list to

    3. Select Page Layouts

    4. Select the page layout to modify

    5. From the Layout section, select Related Lists

    6. Drag Files to a section of the page

      Consider creating a Files section on the page layout.

    7. Click Save

    8. Repeat for any other page layouts and for other objects

  2. Add the Sync to Mobile field to the Content Version Layout.

    If you need other custom fields, you must use the Chatter API instead.

    1. Go to Setup → Object Manager → Content Version → Page Layout (Lightning Experience)

      ~ or ~

      Go to Setup → Build → Customize → Salesforce Files → Page Layout → Edit (Salesforce Classic)

    2. Select Fields.

    3. Drag Sync to Mobile to the Content Version Detail section.

    4. Click Save.

  3. In Custom Settings, select the Use FileAPI setting in FX Settings.

    1. Go to Setup → Custom Settings → FX Settings

    2. Select Manage

    3. Select Edit

    4. Select the checkbox for Use FileAPI, then click Save

Use a Files API Visual Force Section on Job and Ticket Objects

We added new Visualforce pages to give visibility to files for Jobs and Tickets.

  1. In Custom Settings, select the Use FileAPI setting in FX Settings.

    1. Go to Setup → Custom Settings → FX Settings

    2. Select Manage

    3. Select Edit

    4. Select the checkbox for Use FileAPI, then click Save

  2. Add a new section called FX Files to page layouts for Job and Ticket objects.

    1. On Job page layouts:

      • Add FXFilesSync_Job Visualforce Pages to the FX Files section.

      • Edit the Visualforce Page Properties and set the height to 375.

    2. On Ticket page layouts:

      • Add FXFileSync_Ticket Visualforce Pages to the FX Files section.

      • Edit the Visualforce Page Properties and set the height to 375.

From the files list, use the Sync to Mobile checkbox to set whether the file syncs to mobile devices.

Setting Up the Attachments Feature Using the Chatter API

If implementing the Files API above, do not set up the Chatter API feature. Unexpected results may occur.

Attachments using the Chatter API will be deprecated soon. Use the Files API if possible.

To sync files to mobile from Salesforce Classic, use Chatter Attachments.The following instructions detail how to set up the Attachments feature through Chatter.

  1. Access FieldFX Back Office.

  2. Switch to Salesforce Classic.

  3. Configure Salesforce Files Settings:

    1. From Setup, enter "general" in the Quick Find box, then select CustomizeSalesforce FilesSettingsGeneral Settings.

    2. Click Edit.

    3. Deselect Files uploaded to the Attachments related list on records are uploaded as Salesforce files, not as attachments.

    4. Click Save.

  4. Enable Chatter:

    1. From Setup, enter "chatter" in the Quick Find box, then select ChatterChatter Settings.

    2. Click Edit.

    3. Under Chatter Settings, select Enable.

    4. Under Actions in Publisher, select Enable Actions in Publisher.

    5. Click Save.

      If the org has enabled Profile-Based Chatter, you must also enable chatter for each Profile or Permission Set.

      See Salesforce Help for more information about Profile Based Chatter and instructions for enabling Chatter for profiles or permission sets.

  5. Configure Chatter:

    1. From Setup, enter "feed tracking" in the Quick Find box, then select Feed Tracking.

    2. In the Object list, select an object that will use attachments.

    3. Select Enable Feed Tracking.

    4. Click Save.

    5. Repeat steps b to d.

      Objects that do not have Feed Tracking enabled do not allow file attachments from mobile.

  6. Configure FX Settings:

    1. From Setup, enter "custom settings" in the Quick Find box, then select Custom Settings.

    2. Click Manage next to FX Settings.

    3. Click Edit to modify organizational default settings.

    4. Select Auto Follow Job and Ticket.

    5. Click Save.

  7. Configure publisher actions:

    1. From Setup, enter "object" in the Quick Find box, then select Objects.

    2. Open an object that uses attachments.

    3. Under Page Layouts, click Edit next to a page layout for FieldFX Back Office.

    4. Under Publisher Actions, click the override the global publisher link.

    5. Click Save.

    6. Repeat steps c to e for every page layout.

    7. Repeat steps a to f for every object that uses attachments.

  8. Add a Visualforce page for objects that uses attachments:

    The Job and Ticket objects have preconfigured Visualforce pages for the Attachments feature.

    Therefore, you don’t need to add new Visualforce pages for these objects.

    1. From Setup, enter "pages" in the Quick Find box, then select Visualforce Pages.

    2. Click New.

    3. In Label, enter a page name.

    4. In Name, enter the page name with underscores for spaces.

    5. Copy the following code:

      <apex:page standardController="ObjectName">
      <FX5:AttachmentExt />
      </apex:page>
    6. Replace the code on the Visualforce Markup tab by pasting over it with the code you copied.

    7. In the first line of the code, replace "ObjectName" with the name of an object that uses attachments.

      <apex:page standardController="FX5__Quote__c">
    8. Click the Version Settings tab.

    9. Click -- Select to Add Installed Package -- and select "FieldFX Base Package".

    10. Click Save.

    11. Repeat steps a to j.

  9. (Optional) Add custom fields to the Attachment Ext object to store information about attachments:

    1. From Setup, enter "object" in the Quick Find box, then select Objects.

    2. Click Attachment Ext.

    3. Under Custom Fields & Relationships, click New.

    4. Select the type of field to add.

    5. Click Next.

    6. Enter field attributes.

    7. Click Next.

    8. Click Visible twice.

    9. Click Next.

    10. Click Save & New.

    11. Repeat steps d to j.Click Save to finish.

    12. Grant permissions for the fields.

  10. Edit the JobFields and TicketFields field sets:

    1. On the Attachment Ext object under Field Sets, click Edit next to JobFields.

    2. Drag the fields to display for job attachments into the In the Field Set list.

      The Type, TItle, Last Modified, and Created By fields always display for attachments.

    3. Click Save.

    4. Under Field Sets, click Edit next to TicketFields.

    5. Drag the fields to display for ticket attachments into the In the Field Set list.

      The Type, TItle, Last Modified, and Created By fields always display for attachments.

    6. Click Save.

  11. Add field sets for the other objects that use attachments:

    1. On the Attachment Ext object under Field Sets, click New.

    2. In Field Set Label, enter "XXXFields" where "XXX" is the name of an object that uses attachments.

      Enter "TicketFields" to add a field set for the Ticket object.

    3. In Where is this used, enter a note to explain the field set’s usage.

      Used for the Ticket Attachments list.

    4. Click Save.

    5. Drag the fields to display for attachments into the In the Field Set list.

      The Type, TItle, Last Modified, and Created By fields always display for attachments.

    6. Click Save.

    7. Repeat steps a to f.

  12. Update the page layouts for objects that use attachments:

    1. From Setup, enter "object" in the Quick Find box, then select Objects.

    2. Open an object that uses attachments.

    3. Under Page Layouts, click Edit next to a page layout for FieldFX Back Office.

    4. On the toolbar, click Visualforce Pages.

    5. Drag Section onto the layout.

    6. In Section Name, enter "FieldFX Attachments".

    7. Click OK.

    8. Drag the Visualforce page for attachments into the FieldFX Attachments list.

    9. Move down to the Related Lists section and remove the Notes & Attachments list.

      For the Job object, drag the Job Attachment Ext page into the FieldFX Attachments list.

    10. Click Save.

    11. Repeat steps c to i for every page layout.

    12. Repeat steps a to j for every object that uses attachments.

  13. Grant permission to use the Apex classes and Visualforce pages for attachments:

    1. From Setup, enter "permission" in the Quick Find box, then select Permission Sets.

    2. Open a permission set for Visualforce pages.

    3. Under Apps, click Apex Class Access.

    4. Click Edit.

    5. Add the following to Enabled Apex Classes:

      • FX5.AttachmentExtController

      • FX5.AttachmentExt_Test

    6. Click Save.

    7. At the top of the page, click the arrow next to Apex Class Access and select Visualforce Page Access.

    8. Click Edit.

    9. Add the following to Enabled Visualforce Pages:

      • FX5.ChatterFeedAttachment

      • FX5.ChatterFeedPopupRedirect

      • FX5.JobAttachmentExt

      • FX5.TicketAttachmentExt

    10. Click Save.

    11. Repeat steps a to j.