Search code examples
salesforceazure-logic-apps

How to use a Salesforce Connector on Azure Logic App to get Change Record using a dynamic filter query


I have a logic App which starts with a Salesforce Trigger where it checks for Account updates. I want only records where createdate is >= today-20days.

enter image description here

 "queries": {
                        "$filter": "CreateDate ge '@{formatDateTime(addDays(utcNow(), -20), 'yyyy-MM-dd')}'"

If I enable this filter I do not get any records. If I delete this filter I get records where CreateDate is more than 20 days ago which I want to filter.


Solution

  • After reproducing from my end, I can see that the mentioned filter is working fine.

    I used the same query provided by you. enter image description here

    queries": {
    "$filter": "CreateDate ge '@{formatDateTime(addDays(utcNow(), -20), 'yyyy-MM-dd')}'"
    }
    

    Results:

    enter image description here

    If I enable this filter I do not get any records.

    The above expression retrieves the results of records that are 20 days ago. Since, you aren't receiving any data or error, that indicates there are no records that are in the last 20 days.