AttachHub

AttachHub Logo  Obtain various types of attachments from other Android apps and easily upload them, alongside record updates, to your Salesforce account; works both online and offline.

Overview

Use AttachHub as a “hub” to obtain documents, pictures, videos, voice recordings, etc from your other Android apps and upload them as attachments to selected Salesforce records. AttachHub also allows you to make edits to those records.

Create a set of “filters” that specify which Salesforce records should be cached in the encrypted Salesforce SmartStore on the device.

The SmartStore allows for offline operation and reduces API calls to Salesforce. The attachments and updates are also stored in the SmartStore until they are uploaded. Upload immediately after acquisition or upload all of them in a single operation at a more convenient time later.

There are 2 ways to exchange data with your Android apps: on the Records page, tap the Acquire button to bring up an Android app, or a “chooser” in case multiple apps of the same category exist on your device. To change the category of apps to bring up select a category on the Options page (tap on the input labeled “Obtain attachments from”).

Alternatively, run the Android app that will produce the attachment and then “share” the resulting attachment with other apps (AttachHub will be present in the list of apps that the chooser brings up).

Screenshot of AttachHub mobile app.Filter Page

Use Filters to select records from Salesforce to store in the encrypted SmartStore on your device. For performance and security reasons you should only store those records that you truly need to get your work done out in the field. You can retrieve standard Salesforce records such Accounts, Contacts, etc, and any custom records.

You can pick the fields that you need to have displayed as “columns” in the Record page. These are also the fields that can be edited with AttachHub. The selection criteria allow you to specify the retrieval clauses (for example, “if Account Name starts with United and Annual Revenue is greater than 30000000”) to limit the number of records retrieved from Salesforce. These selection criteria work similar to the View selection criteria in the Salesforce UI.

Use Edit to modify an existing filter. Note that filters with pending attachments and updates cannot be changed. Also, changing a filter will result in replacing the records in the SmartStore with the latest from Salesforce. As a convenience while you are creating a new filter you can switch back and forth between the Filter and Records pages (to see what is being retrieved) without having to save the filter yet (by tapping the name in the filter bar or select a page in the navigation bar). Filter changes are not allowed when AttachHub is operating in offline mode.

Note: geolocation-based values in filter selection criteria must be specified as a 3-part value. For example, 20mi;37.775;-122.418, which indicates that the location field in the record must be within 20 miles of latitude 37.775 and longitude -122.418 to get included in the result set.

The AND/OR clauses allow for the following SOQL “WHERE” combinations: a and b and c, a or b or c, (a or b) and c, a and (b or c). Clauses are taken into account only if you enter a value.

Screenshot of AttachHub mobile app.Records Page

The records specified by the filter are displayed on the Record page. Tap the caret of the dropdown in the top-left corner to select a different filter. In the top right text box, enter a search string to limit the number of records displayed to the matched set only. If not all columns specified in the filter can be displayed, a “+” sign is shown to indicate that the row can be expanded by tapping it to show the remaining columns. Typically you select a row by tapping it and press the Acquire button to capture an attachment from another Android app.

The Record page is also shown when AttachHub is invoked when you opt to share an item in another Android app. When an attachment becomes available, a dialog is shown that allows you to change the default name and add a description. If Save is tapped, the attachment is stored in the SmartStore and the (Att) column is updated.

Note that that attachments and updates are stored separately from the records. This way you can always refresh records to the latest version and optionally consolidate any changes that were made to the records since they were last retrieved with the pending edits that you made. Note that in the Edit page the current value of the record is always shown below the edited value (and the current value is updated each time the record is refreshed).

Screenshot of AttachHub mobile app.Records Page More

Tap the Edit button to make changes to the selected record. After accepting the changes, the (Updt) column is updated. Edits to the record are stored separately to allow a fresh retrieval of the record from Salesforce while the update is pending upload.

Tap the column header to sort the records by the tapped column. Tapping a column header again reverses the sort order. When the (Att) or (Updt) column header is tapped only records with pending attachments and updates are shown so you can see at a glance which records have attachments and/or updates pending.

Tap Refresh to retrieve the latest version of the records in the filter from Salesforce. Once a record has one or more pending attachments, tap the View button to “view” the attachments. Tap the Reset button to remove both attachments and updates from the selected record.

Acquiring attachments means bringing up an Android application (other than AttachHub) to obtain or create the attachment. Android allows for various categories of apps. To change the category of apps brought up when the Acquire button is tapped, change the “Obtain attachments from” selection in the Options page.

Note that “viewing” an attachment may mean playing back an attachment in case the attachment is an audio recording, for example.

Screenshot of AttachHub mobile app.Upload Page

Select the Update page to upload the acquired attachments and updates to selected records to Salesforce. When the page is loaded, AttachHub consults the SmartStore to determine how many attachments and updates to records are present. Tap the Start Upload button which starts the transfer to Salesforce after acknowledging the confirmation message. For each record first the attachment(s) are uploaded followed by the record updates. If an error occurs during the upload, AttachHub switches to the Record page with only the “offending” record shown (so it can be corrected).

To discard all accumulated attachments and updates, tap the Discard All button. The attachments and updates are permanently deleted after confirmation.

You can use this page in 2 ways: either switch to it immediately after acquiring an attachment to upload it (typically if the device is online with a fast connection), or first acquire all attachments and updates, and only start uploading them when all of them have been captured and you are back in the office (typically if the device is offline most of the time).

When no attachments and updates to records are available, both the Start Upload and the Discard All buttons are disabled. In addition, a hint indicating this condition is displayed under the mentioned buttons.

Options Page

Use the Options page to quickly change AttachHub configuration settings or take actions such as retrieving all records from Salesforce that are specified by the filters. Select “Obtain Attachments From” to change the category of Android apps that will be brought up when the Acquire button on the Records page is tapped. Set the “Data Access Mode” to Offline to change the UI (i.e. remove buttons) to prevent accidental attempts to go online.

Use the “Maximum attachment size” to limit the size of attachments that AttachHub will accept. Salesforce allows attachments of up to 5120KB (5MB) in size. Although AttachHub supports attachments of this size, for performance reasons it is recommended to keep the size of attachments small. To provide maximum security for attachments containing sensitive information, AttachHub stores attachments in the encrypted SmartStore even though the SmartStore is not optimized for storing and retrieving “blobs” such as attachments.

Options Page More

Enter a non-zero page size to enable “paging” in the Records page. The default value is zero (paging disabled) which allows for swiping up and down to quickly browse/scroll through the entire list of records in the Records page. Note, however, that for performance reasons there is a limit of 100 records that can fit in the Records page. When this maximum is exceeded AttachHub automatically enables paging. Enter a non-zero page size (up to 100) to always enable paging. A page size of -1 selects “fitted” paging where AttachHub attempts to calculate how many rows of records will fit on a page without having to swipe up or down to see all records. 

Tap the Refresh All button to retrieve the latest version of all records specified by all filters. Since this operation also refreshes all filters, it can only be performed when no pending attachment and/or updates are present.

Tap the Salesforce Logout button to log out of your Salesforce instance. Note that this action will have a significant impact since ALL DATA stored in the SmartStore on the device by AttachHub will be deleted including pending attachments and updates that have not been uploaded yet. This is standard Salesforce security policy for the SmartStore and there is no way to undo this action.

Refresh All is a convenient way to “load” the device with cached records from Salesforce once the filters have been defined. You can also refresh individual filters by tapping the Refresh button on the Records page. Once the records for a filter are cached in the SmartStore on the device, AttachHub will not reach out to Salesforce anymore to retrieve those records; they are retrieved from the SmartStore instead (to minimize the number of REST API calls made to Salesforce and to allow offline operation).

Logging out of Salesforce allows you to log into a difference instance of Salesforce. Since ALL DATA stored by AttachHub (previously retrieved records, pending attachments and updates, and filters) are permanently removed, it is also a quick way to “clean” existing data stored by AttachHub from your device.

Screenshot of AttachHub mobile app.Security Aspects

Since AttachHub is based on the Salesforce Mobile SDK, the security configuration options for Connected Apps as provided by Salesforce to administrators are fully supported. It is strongly recommended to enable Pin Protection for AttachHub which will lock up AttachHub if it has not been used for the specified number of minutes.  Users can also revoke the oAuth access token granted to AttachHub at any time (using MySettings/Connections). When the oAuth access token is revoked, AttachHub will automatically log out the next time it attempts to connect to  your Salesforce org.

Note however, since AttachHub caches retrieved data to allow for offline operation, automatic logout will not occur instantaneously when the access token is revoked (only when AttachHub is directed to access your Salesforce org by selecting an action such as Refresh or Upload All, for example). That is the reason why it is very important to enable Pin Protection for AttachHub, ideally with the full 8 digits and a very short Session Timeout. As mentioned earlier, a logout (either manually or automatic) deletes all data cached by AttachHub in the SmartStore on the device.

Security aspects also play a role in limiting the number of filters to 10 and allowing only 25 records per filter. That way a maximum of 250 records can be cached on the device. As mentioned earlier, you should restrict the filters to include only those records you will need on the device to do your work. For security reasons, in case a mobile device is lost or stolen, the less data it contains the better. To remove the cached records and only store the records retrieved by the first filter, logout from Salesforce and log back in.

Credits

Betsy_64x72AttachHub is produced by Betsydog Inc., a company specialized in the development of mobile apps using both native and web technologies, in particular mobile software for the Salesforce Platform. This version of AttachHub is based on HTML, CSS and JavaScript, and great supporting technologies from: