In this article, you will learn how to set up the Digital Asset Repository and have these assets appear directly in the form.
Before you get started
These articles might be helpful before you read further:
What is it?
The Digital Asset Repository or DAR for short, provides powerful contextual photo knowledge that can be transferred from one visit to the next. Here’s a quick example:
An inspector visits a property and identifies damage on the customer's roof, they take photos of damage for their report and issue a quote to the customer. A week later, a field worker goes onsite to fix the roof. In the second form, they can see the photos of the damage from the inspection, prepare accordingly and ensure the exact issue quotes is being fixed. Let's see how it works.
In the example below, we have a DAR with photos taken from a prior visit. The user did not did not take these photos in the form; the user did not have to do anything to retrieve these photos from their device. When they opened the Form, the photos came pre loaded as context from a previous file loaded in Salesforce (likely from a previous form).
When authoring a template, drag a Content block onto the template canvas. Select the type called Digital Asset Repository.
On the Digital Asset Repository content there are 4 fields to set:
- Lookup Object - The Files & Attachments on this record will be displayed within the DAR content within the Form. Only Files that existed on the Parent Record at time of Form Generation and that meet the limits will be displayed
- Order By Field - Defines if the Files are sorted by their Last Modified Date or Title.
Sort Order - When retrieving Files from the Parent Record this defines which first 5 (or less) files will be retrieved.
Ascending for Title will take the first 5 in alphabetical order.
Ascending for Last Modified Date will take the oldest 5 files.
Descending for Title will take the last 5 in alphabetical order.
Descending for Last Modified Date will take the newest 5 files.
Filter Value - Will only include Files that have the text in the filter field in the DAR. For example, if you enter the word "meter" it will only include files where the Title has the word "meter" in it.
Note: The filter is a wildcard search on the title of the Files you are looking to retrieve. It adds this to the query for the File records: WHERE Title LIKE %filter value%
- Maximum Number of Files - The DAR will never download more than 5 files, this can be set to a lower number in order to decrease sync times.
TIP: When collecting photos on a Form that will need to be included in a follow-up Form DAR Content, automatically label your photos’ title taken from prior visits with the Question Text. This ensures that your photos are all labeled properly so they can be filtered in easily based off of a title that is auto naming photos:
Then the DAR will pull in up to 5 photos and files based on your filter criteria. You can setup multiple DARs if desired. Do note that adding photo data will change the performance of the application. This may add to download and sync times.
When the form is created, the photo File IDs are retrieved and added into the DAR Answer of the Form. These Photos & PDFs will be displayed within the Form when it loads.
It’s very important to note that the Form must be created while online. Forms that are created offline will not have access to Files related to the target parent object and will not be included.
There’s one more important concept to cover: How do the Files get related to the parent record of my form? Good question. We’ll cover that here.
In order for the Digital Asset Repository to retrieve Files from the parent record, the files need to be related to that parent record. This is something that can be done manually, or through automation.
Let’s say our parent object is a Work Order. We can manually attach a file to Salesforce Files on the Work Order for the Digital Asset Repository to consume and add those files onto the form.
This can also be achieved through automation. The Photos and Files that are created from previous Youreka Forms are related to each specific Answer record on the Form. Those Photos can be linked to any additional record by creating Content Document Link records in Salesforce. There is a detailed support document that walks through using Flow and Apex here.
In order for a Form to populate with all the Digital Asset files, the end result is that the Answer record must be populated with the Content Document Ids when the Form is created. The Form will then render images based on those record Ids on the Answer.
Here is a Flow that creates Content Document Links between Files on Answers to a parent record like Work Order that the Form is attached to. The Flow starts by waiting a minute to ensure there is time for the File to be published in Salesforce. The flow will only fire on Answers that have a label of “file(s)”, which is the text answer for photo and file questions. Then it retrieves all of the content document links related to those answers, then loops through each of them and creates a new content document link that pushes in a few values like the Linked Entity Id being the Work Order record id.
Keep in mind that this is a simple flow solution, you may need or want to make additional changes to suit your organizations processes. Specifically, you’ll want to change the parent lookup from Work Order to the target parent object where the Files reside. Here is an unmanaged package with the flow above for installing in sandbox or dev env for testing.
Considerations and Limits
The DAR supports Salesforce Files (Content Documents). It does not support the Salesforce Classic Attachment object. Please ensure PDFs and Attachments use the Salesforce Files object.
The Form must be created while online. Forms that are created offline will not have access to Files related to the target parent object and will not be included.
Only when the Form is generated it will pull File Record Ids from the Parent Record. If the Parent Record is updated afterwards, the Form will not be updated with the latest Files.
Each Digital Asset Repository question can have up to 5 files. This can be adjusted downward in the template builder. You can have multiple DARs per template, but keep in mind how it may impact performance and sync times.
Digital Asset Repository questions can only be added to Standard Sections, not in Shared Linked Sections.
Supported File Types: JPG, JPEG, PNG, GIF and PDF.
Supported File Sizes: The max file size is 2MB. In the Youreka Public Settings this can be lowered by setting the value in the Digital Asset Repository File Max Size setting.
When leveraging Youreka's Native PDF Generation only jpg and jpeg files in the Digital Asset Repository will appear in the generated PDF. If the Digital Asset Repository includes PDFs those will not be added to the generated PDF.
The more Digital Repository Assets on a Form the longer it will take to sync. Be sure to thoroughly test the all Form Templates on Mobile and how it impacts end user performance.