Join the Power Platform Masterclass #2 starting April 23

Sync Filter examples: Difference between revisions

Jump to navigation Jump to search
(Created page with "This article lists several simpler examples of Sync Filter without linked entities. Notes: * SyncFilter fetches are incomplete - they do not list attributes (entity prope...")
 
Line 143: Line 143:
</fetch></syntaxhighlight>
</fetch></syntaxhighlight>


== Private emails and team emails ==
== Private and team emails ==
My emails or emails owned by either myself or my team(s) which are up to 60 months old
My emails or emails owned by either myself or my team(s) which are up to 60 months old.
<syntaxhighlight lang="xml> <fetch version="1.0">
<syntaxhighlight lang="xml> <fetch version="1.0">
<entity name="email">
<entity name="email">
Line 160: Line 160:
</fetch></syntaxhighlight>
</fetch></syntaxhighlight>


// Emails related (regardingobjectid) to my business unit (BU)
== Related emails ==
<syntaxhighlight lang="xml> <fetch version="1.0">
Show only emails related (regardingobjectid) to my business unit.
<entity name="email">
<syntaxhighlight lang="xml><fetch version="1.0">
<filter type="and">
<entity name="email">
<condition attribute="regardingobjectid" operator="eq-businessid" />
<filter type="and">
</filter>
<condition attribute="regardingobjectid" operator="eq-businessid" />
</entity>
</filter>
</fetch></syntaxhighlight>
</entity>
</fetch></syntaxhighlight>
 
== Open cases ==
Show all open cases from last 60 days.
<syntaxhighlight lang="xml><fetch version="1.0">
<entity name="incident">
<filter type="and">
<condition attribute="modifiedon" operator="last-x-days" value="60" />
<condition attribute="statuscode" operator="not-in">
<value>5</value>
<value>6</value>
</condition>
</filter>
</entity>
</fetch></syntaxhighlight>


// All open cases from last 60 days
== Omit inactive templates ==
<syntaxhighlight lang="xml> <fetch version="1.0">
This filter shows all questionnaires except inactive templates.
<entity name="incident">
<filter type="and">
<condition attribute="modifiedon" operator="last-x-days" value="60" />
<condition attribute="statuscode" operator="not-in">
<value>5</value>
<value>6</value>
</condition>
</filter>
</entity>
</fetch></syntaxhighlight>


// Questionnaires except inactive templates
<syntaxhighlight lang="xml><fetch version="1.0">
<syntaxhighlight lang="xml> <fetch version="1.0">
<entity name="resco_questionnaire">
<entity name="resco_questionnaire">
<filter type="and">
<filter type="and">
<filter type="or">
<filter type="or">
<condition attribute="resco_istemplate" operator="ne" value="1" />
<condition attribute="resco_istemplate" operator="ne" value="1" />
<filter type="and">
<filter type="and">
<condition attribute="resco_istemplate" operator="eq" value="1" />
<condition attribute="resco_istemplate" operator="eq" value="1" />
<condition attribute="statuscode" operator="eq" value="1" />
<condition attribute="statuscode" operator="eq" value="1" />
</filter>
</filter>
</filter>
</filter>
</filter>
</entity>
</filter>
</fetch></syntaxhighlight>
</entity>
</fetch></syntaxhighlight>
 
== Complex example ==
 
This is an example of a more complex sync filter for the Annotation entity. Records must match one of the following conditions:
* Annotations associated with opportunities or products
* Notes (text annotations) not older than 3 months
* Attachments (document annotations) associated with contacts, emails, tasks or appointments modified within last month
* Attachments associated with accounts whose name ends with Products per Team.xls
* Attachments associated with quotes max 12 months old


// And finally one more complex example:
<syntaxhighlight lang="xml><fetch version="1.0">
// Annotations fullfilling one of the conditions:
<entity name="annotation">
// - Annotations associated to opportunities or products
<filter type="and">
// - Notes (text annotations) max 3 months old
<filter type="or">
// - Attachments (document annotations) associated to contacts, emails, tasks or appointments modified within last month
<condition attribute="objecttypecode" operator="in">
// - Attachments associated to accounts whose name ends with Products per Team.xls
<value>3</value>
// - Attachments associated to quotes max 12 months old
<value>1024</value>
<syntaxhighlight lang="xml> <fetch version="1.0">
</condition>
<entity name="annotation">
<filter type="and">
<filter type="and">
<condition attribute="isdocument" operator="eq" value="0"/>
<filter type="or">
<condition attribute="modifiedon" operator="last-x-months" value="3"/>
</filter>
<filter type="and">
<condition attribute="isdocument" operator="eq" value="1"/>
<condition attribute="objecttypecode" operator="in">
<condition attribute="objecttypecode" operator="in">
<value>3</value>
<value>2</value>
<value>1024</value>
<value>4202</value>
<value>4212</value>
<value>4201</value>
</condition>
</condition>
<filter type="and">
<condition attribute="modifiedon" operator="last-x-months" value="1"/>
<condition attribute="isdocument" operator="eq" value="0"/>
</filter>
<condition attribute="modifiedon" operator="last-x-months" value="3"/>
<filter type="and">
</filter>
<condition attribute="isdocument" operator="eq" value="1"/>
<filter type="and">
<condition attribute="objecttypecode" operator="eq" value="1"/>
<condition attribute="isdocument" operator="eq" value="1"/>
<condition attribute="subject" operator="like" value="%Products per Team.xls"/>
<condition attribute="objecttypecode" operator="in">
</filter>
<value>2</value>
<filter type="and">
<value>4202</value>
<condition attribute="isdocument" operator="eq" value="1"/>
<value>4212</value>
<condition attribute="objecttypecode" operator="eq" value="1084"/>
<value>4201</value>
<condition attribute="modifiedon" operator="last-x-months" value="12"/>
</condition>
<condition attribute="modifiedon" operator="last-x-months" value="1"/>
</filter>
<filter type="and">
<condition attribute="isdocument" operator="eq" value="1"/>
<condition attribute="objecttypecode" operator="eq" value="1"/>
<condition attribute="subject" operator="like" value="%Products per Team.xls"/>
</filter>
<filter type="and">
<condition attribute="isdocument" operator="eq" value="1"/>
<condition attribute="objecttypecode" operator="eq" value="1084"/>
<condition attribute="modifiedon" operator="last-x-months" value="12"/>
</filter>
</filter>
</filter>
</filter>
</filter>
</entity>
</filter>
</fetch></syntaxhighlight>
</entity>
</fetch></syntaxhighlight>


</fetchcollection>
[[Category:Woodford]] [[Category:Support]]

Navigation menu