Search code examples
phpapidynamics-crmdynamics-crm-webapi

Dynamics Crm apply filter on expand


Need to apply filter in expand query.Requirement is search primary contacts of account by yomi full name.

If any way to identify the primary contacts in contact entity.

URl:

/accounts?$expand=primarycontactid($select=contactid,fullname)&$top=3

Expected Is:

 If search name is john then contact having fullname john only get listed.

Tried:

/accounts?$expand=primarycontactid($select=contactid,fullname&$filter=contains(yomifullname,%27'. $key .'%27))&$top=3

Solution

  • You have to use semicolon ; in between clauses like $expand=primarycontactid($select=contactid,fullname;$filter=contains(yomifullname,'arun'))

    Try this:

    https://crmdev.crm.dynamics.com/api/data/v9.0/accounts?$select=accountid,accountnumber,name&$expand=primarycontactid($select=contactid,fullname;$filter=contains(yomifullname,'arun'))&$top=3
    

    Reference