Happy Business Starts Here

Create Liquid expressions to subtract one day from today's date

DavidM
Zuora Support

Create Liquid expressions to subtract one day from today's date

Problem: Customer trying to query custom object for recordcreatedate__c = yesterday. how to format this request to yesterday, previously we had used recordcreatedate__c: {{Data.Workflow.ExecutionDate}}; however we need to update it so we take recordcreatedate__c: {{Data.Workflow.ExecutionDate}}-1 day. additionally, we can use CreatedDate: today, but cannot find the function for today.

 

Solution: To extract Yesterday's date pass "now" instead of "today" or "Yesterday" where DATE and MINUS(86400 seconds is 24 hours) filters give data in date format.

{% assign now = Data.Workflow.ExecutionDate %}
{% assign DateYesterday = "now" | date:'%s' | minus: 86400 | date: '%Y-%m-%d' %}
recordcreationdate__c:"{{DateYesterday}}"

output :
recordcreationdate__c:"2021-02-22"



If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √