Join the Power Platform Masterclass #2 starting April 23

Sync Filter: Difference between revisions

Jump to navigation Jump to search
4,432 bytes added ,  22 June 2021
No edit summary
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Note|This article introduces the concepts and basic functions of the Sync Filter. To jump into action, check out also the '''[[Sync Filter examples]]''' in FetchXML format.|Tip}}
{{Synchronization TOC}}
{{Synchronization TOC}}
Synchronization filters define what data from the server is replicated in the [[Resco Mobile CRM]] application after a [[synchronization]]. Filters are defined in [[Woodford]]; each entity for each app project can have custom settings.
Synchronization filters define what data from the server is replicated in the [[Resco Mobile CRM]] application after a [[synchronization]]. Filters are defined in [[Woodford]]; each entity for each app project can have custom settings.
 
== Editing the sync filter ==
 
# Edit an [[App_projects#Managing_entities|app project]].
# Select an entity from the '''Project''' menu > '''Entities'''.
# Click '''Show Fields''' to display the list of entity fields.
# Click '''Sync Filter'''. The conditions are defined using the generic [[Filter editor]] user interface.
 
[[File:Sync filter.png|600px]]
 
== Editing the sync filter as XML ==
 
Internally, the sync filters for all entities are saved into a single file, SyncFilter.xml. If you prefer to edit the sync filter directly as XML, you have two options.
 
=== Per-entity editing ===
 
# Edit the sync filter for an entity as described in the previous section.
# Click '''Export XML''' to download the sync filter for the entity as an XML file.
# Edit the file in your favorite editor, perform any changes as needed.
# Return to Woodford and upload the modified XML file using the '''Import XML''' button.
# Save all changes.
 
=== Editing the entire SyncFilter.xml ===
 
# On the list of all your app projects in Woodford, select a project and click '''Export''' to download the entire project.
# Change the extension of the downloaded file from "woodford" to "zip".
# Extract the file SyncFilter.xml from the Configuration folder and modify it as needed.
# Add the modified file back to the archive.
# Change the extension back to "woodford" and import the file to Woodford.
 
[[File:Export and rename project.png|600px]]
 
{{Note|If you want to upload a modified version of the app project back into Woodford, always keep a backup copy of the original file.|Warning}}
 
=== Why use XML ===
 
Some Woodford administrators prefer editing the filter in XML format because they are familiar with the used [[FetchXML]] format. See [[Sync_Filter#Analyzing_SyncFilter.xml|Analyzing SyncFilter.xml]] below for more information.
 
Additionally, there's also a rare scenario where the Woodford filter editor user interface does not allow you to be as exact in your sync filter as you need: some [[FetchXML#Special_FetchXML_options_for_Dynamics|SQL server optimization options for Dynamics]] can only be edited in XML format.


== Introduction ==
== Introduction ==
Line 23: Line 63:
#* Click the field and select '''Created On''' from the dropdown menu.
#* Click the field and select '''Created On''' from the dropdown menu.
#* Click the operator and select '''Last X Days''' from the dropdown menu.
#* Click the operator and select '''Last X Days''' from the dropdown menu.
#* Enter the number: 120.
#* Enter the number: 120.<br>[[File:Sync filter opportunity.png]]
# Click '''Save & Close'''.
# Click '''Save & Close'''.


Line 29: Line 69:


Incremental linked sync filter, available for Dynamics CRM, ensures that linked filters on entities are checked during incremental synchronization. Without enabling it, the only initial filter for downloading records from server is the one checking whether the entity records were changed since last synchronization.
Incremental linked sync filter, available for Dynamics CRM, ensures that linked filters on entities are checked during incremental synchronization. Without enabling it, the only initial filter for downloading records from server is the one checking whether the entity records were changed since last synchronization.
This feature can be enabled per entity; see [[App_projects#Managing_entities|Managing entities]] for instructions.


The use case for this filter is best shown on an example:
The use case for this filter is best shown on an example:
Line 34: Line 76:
* As a result, the changed account record is downloaded (based on the incremental synchronization definition from previous section).
* As a result, the changed account record is downloaded (based on the incremental synchronization definition from previous section).
* But what if the account has associated records, which are not downloaded as they were not changed on the CRM?
* But what if the account has associated records, which are not downloaded as they were not changed on the CRM?
The following section explains it.


Incremental linked sync filter in practice:
Incremental linked sync filter in practice:
Line 68: Line 108:
== Use sync filter in online mode ==
== Use sync filter in online mode ==


If you want to ensure the same data in the application in online and offline mode, you can force using of the sync filter also in online mode. This can be configured for each mobile [[view]]; edit the properties of your view and enable '''Sync Filter - Use Sync Filter in Online Mode'''.
If you want to ensure the same data in the application in online and offline mode, you can force using the sync filter also in online mode. This can be configured for each mobile [[view]]; edit the properties of your view and enable '''Sync Filter - Use Sync Filter in Online Mode'''.
 
== Mark as Parent Pointer ==
 
You can enable the parameter [[Mark as Parent Pointer]] in the properties of a lookup field to ensure that both parent and child records are available. However, this setting is only effective if the lookup has only a single lookup target (also displayed on the [[App_projects#Managing_fields|properties pane for entity fields]]). When you use this option, the sync filter of the parent entity is also used for synchronization (application uses this flag and runs the parent sync filter in the code, parent sync filter will not be copied to the child entity sync filter). See [[Sync Filter examples with child entities]] for a more detailed explanation.
 
== Analyzing SyncFilter.xml ==
 
When you synchronize your device with an app project, the sync filters for all entities are saved in one file, SyncFilter.xml. In the case of Windows apps, you can easily find this file on your file system; see [[Log_files#Finding_physical_files_in_Windows_versions_of_mobile_apps|finding physical files]]. If you're in charge of troubleshooting sync filter issues, it may make your life easier if you can read and understand the file SyncFilter.xml directly, instead of relying on the Woodford representation.
 
For example, your sync filter file may start with the Account entity:
 
<syntaxhighlight lang="xml">
<fetchcollection>
  <fetch version="1.0">
    <entity name="account">
      <filter type="and">
        <condition attribute="statuscode" operator="ne" value="2"/>
        <condition attribute="ownerid" operator="eq-userid"/>
      </filter>
    </entity>
  </fetch>
  ...
</fetchcollection>
</syntaxhighlight>
 
This corresponds to the following sync filter:
 
[[File:Sample sync filter.png]]
 
The filter criteria are saved using the [[FetchXML]] query language.
 
If you are already familiar with FetchXML, you can explore additional examples for inspiration.
{{Sync Filter TOC||float=floatleft}}
 
== See also ==
 
* [https://infinite-usa.com/sync-filter/ Third-party Sync Filter guide]


[[Category:Woodford]] [[Category:Synchronization]]
[[Category:Woodford]] [[Category:Synchronization]]

Navigation menu