1

Document filters

From Resco's Wiki
Jump to navigation Jump to search
Synchronization

Synchronization does not mean only the exchange of database records. It also involves documents, often stored on external storage (e.g., a SharePoint server). External storage may contain terabytes of data. Woodford administrator can define document filters; these allow you to synchronize only a subset of the documents and make the synchronization run faster. These filters apply to attachments (such as note/annotation) and cloud documents from external storage.

Documents that are blocked by blob filter can still be available in your app, however, they are only downloaded on-demand and require an active internet connection.

Using blob filters

To edit the blob filter, proceed as follows:

  1. Edit an app project in Woodford.
  2. Select Configuration from the Project menu.
  3. Click Blob Filter to edit the XML configuration document.
  4. Update configuration as needed, then click Save.

If you are using a Windows version of Resco Mobile CRM app for testing your synchronization performance, you can also edit the configuration file of the app directly. Edit the file \Configuration\BlobStoreFilter.xml in your Resco project directory.

Basic syntax

The configuration has two main sections:

  • <FilesFilter> for cloud documents
  • <AttachmentsFilter> for CRM attachments (notes)

Some of the common filter elements:

  • <MaxFileSize> / <MaxAttachmentSize> - specify file size in bytes (0 = all attachments blocked; -1 = unlimited)
  • <NotSyncingAttachmentsFor> / <OnlySyncingAttachmentsFor> - exclude or include only the specified entities
  • <Quota> - Stop downloading when the total size of all cloud documents exceeds the specified value. Not implemented for attachments.

See the examples below for inspiration.

Simple example

<?xml version="1.0" encoding="utf-8"?>
<BlobStoreFilter>
	<FilesFilter>
		<Quota>1000000000</Quota>
		<MaxFileSize>100000</MaxFileSize>
	</FilesFilter>
</BlobStoreFilter>

The filter above is an example of a trivial cloud document filter that says:

  • MaxFileSize: Do not download cloud documents larger than 100K.
  • Quota: Stop downloading when the total size of all cloud documents exceeds 1GB.

Different max file sizes for different file formats

Here is a more complex example:

<?xml version="1.0" encoding="utf-8"?>
<BlobStoreFilter>
	<FilesFilter>
		<Quota>1000000000</Quota>
		<Filters>
			<BlobStoreFileTypeFilter>
				<FileSuffix>jpg</FileSuffix>
				<MaxFileSize>1000000</MaxFileSize>
			</BlobStoreFileTypeFilter>
			<BlobStoreFileTypeFilter>
				<FileSuffix>*</FileSuffix>
				<MaxFileSize>100000</MaxFileSize>
			</BlobStoreFileTypeFilter>
		</Filters>
	</FilesFilter>
</BlobStoreFilter>

The filter above specifies the quota and additional conditions:

  • Download jpeg images up to the 1MB size
  • Any other file type is limited to 100K size

Filtering CRM attachments

The first two examples applied to cloud documents, however, you can filter CRM attachments (notes) as well. Here is an example:

<?xml version="1.0" encoding="utf-8"?>
<BlobStoreFilter>
	<FilesFilter/>
	<AttachmentsFilter>
		<MaxAttachmentSize>300000</MaxAttachmentSize>
		<NotSyncingAttachmentsFor>
			<string>contact</string>
			<string>campaign</string>
		</NotSyncingAttachmentsFor>

		<EntityFilters>
			<EntityAttachmentsFilter Entity="annotation" AttachedTo="account">
				<MaxFileSize>150000</MaxFileSize>
				<Filters>
					<BlobStoreFileTypeFilter>
						<FileSuffix>jpg</FileSuffix>
						<MaxFileSize>50000</MaxFileSize>
					</BlobStoreFileTypeFilter>
					<BlobStoreFileTypeFilter>
						<FileSuffix>doc</FileSuffix>
						<MaxFileSize>100000</MaxFileSize>
					</BlobStoreFileTypeFilter>
				</Filters>
			</EntityAttachmentsFilter>

			<EntityAttachmentsFilter Entity="annotation">
				<Quota>-1</Quota>
				<MaxFileSize>300000</MaxFileSize>
				<Filters />
			</EntityAttachmentsFilter>

			<EntityAttachmentsFilter Entity="activitymimeattachment">
				<Quota>-1</Quota>
				<MaxFileSize>123456</MaxFileSize>
				<Filters />
			</EntityAttachmentsFilter>
		</EntityFilters>
	</AttachmentsFilter>
</BlobStoreFilter>

Explanation:

  • If there are multiple EntityAttachmentsFilter nodes that apply to given attachment, then all of them must be fulfilled.
  • MaxAttachmentSize defines the size limit applicable to all attachments. (Same effect as the parameter Max Attachment Size in the Setup form.)
  • NotSyncingAttachmentsFor is used to specify entity types for which no attachments are downloaded.
  • Account annotations are limited to 150K, however, there is a stricter limit for *.jpg files (50K) and *.doc files (100K).
  • All annotations (except account annotations) are limited to 300K.
  • ActivityMimeAttachment’s use custom size limit.

Filtering by positive condition

Starting with Resco Mobile CRM version 11.1 (Summer Update 2018), you can also utilize a positive condition to filter selected attachments, e.g.:

<AttachmentsFilter>
    <MaxAttachmentSize>100000</MaxAttachmentSize>
    <OnlySyncingAttachmentsFor>
      <string>contact</string>
      <string>account</string>
    </OnlySyncingAttachmentsFor>
</AttachmentsFilter>

Notes:

  • If you specify a document filter, Resco mobile apps fall back to the default values: a quota of 4GB and the Max Attachment Size defined in the app's Setup form.
  • Pay attention that you use one of the forms of the conditions (positive and negative; NotSyncingAttachmentsForm & OnlySyncingAttachmentsForm), but not both. (Formally allowed, but does not make sense.)

The document filter is the most frequent reason that causes not-downloaded documents. Other common errors are various download failures, such as web communication errors.

See also



Was this information helpful? How can we improve?