Happy Business Starts Here

Workflow Liquid code to increment/Decrement dates

Highlighted
Zuora Support

Workflow Liquid code to increment/Decrement dates

Use Case 1: Get all Subscriptions with start date 7 months before today's date.

Use Case 2: Get callouts executed 100 seconds before the current timestamp.

 

Solution:

There are several methods in liquid expressions to do date Math, Zuora recommends using date_manip for the incrementing or decrementing the dates based on ['minute', 'hour', 'day', 'month', 'year'], But to calculate the values in seconds a common liquid expression can be used

UseCase1:

 {{Data.Subscription.TermStartDate | date: "%Y-%m-%d"}} = 
{{"now" | date_manip: '-', 7, 'month' | date: "%Y-%m-%d"}}

 

UseCase2:

{{Data.Workflow.ExecutionDateTime| date: "%FT%T%:z"}} = 
{{"now" | date:'%s' | minus:100 | date: "%FT%T%:zā€}}