Sync Filter examples with linked entities: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
{{Sync Filter TOC}}
{{Sync Filter TOC}}
In some cases, the criteria for which records of table X you want to download depend on a linked or related table Y. For example, if you're in charge of accounts in Boston, you want to see only the contacts of your Boston accounts. To accomplish this, you need to link another entity in your sync filter. We call these '''linked sync filters'''.
In some cases, the criteria for which records of table X you want to download depend on a related table Y. For example, if you're in charge of accounts in Boston, you want to see only the contacts of your Boston accounts. These are only the contacts ''whose parent account'' is in Boston (i.e., the parentcustomerid lookup points to a Boston account). In the FetchXML language, we express this via an inner link from the contact entity to the account entity.
 
<syntaxhighlight lang="xml">
<fetch>
<entity name="contact">
<link-entity name="account" from="accountid" to="parentcustomerid" link-type="inner">
<filter type="and">
<condition attribute="city" operator="eq" value="Boston"/>
</filter>
</link-entity>
</entity>
</fetch>
</syntaxhighlight>
 
In the example above:
* The contact record has a lookup <code>parentcustomerid</code> which points to a unique account record.
* The account record is determined by the entity name <code>account</code> and the ID <code>accountid</code>.
 
We call these '''sync filters with linked entity'''.


{{Note|These examples apply to entities without a formal parent-child relation. The behavior is somewhat different there; see [[Sync Filter examples with child entities]] for details.}}
{{Note|These examples apply to entities without a formal parent-child relation. The behavior is somewhat different there; see [[Sync Filter examples with child entities]] for details.}}


One thing to remember: The sync filters in tables X and Y must be consistent. If you're only downloading accounts from Boston, make sure your contacts table has the same sync filter, downloading contacts related to accounts from Boston. Mismatched linked sync filters may result in longer sync times and inconsistent data.
One thing to remember: The sync filters in tables X and Y must be consistent. If you're only downloading accounts from Boston, make sure your contacts table has a matching sync filter. Mismatched sync filters may result in longer sync times and inconsistent data.


== Active contacts belonging to active accounts ==
== Active contacts belonging to active accounts ==

Navigation menu