Adding a variable number of days to a date

I believe I’ve done this before, but I can’t find it, and I’m not sure what the syntax is. I’m trying to use the statement.

{{date add=“custom.Data.Timeout days” to_tz=“Autotask”}}

Getting an error. What is the correct syntax?

The space in “Timeout days” will make this a little harder. If you can make a variable with no spaces, try this:

{{date add=custom.variable to_tz="Autotask"}}

The custom variable name is just timeout. Days is the units.

Ah, that makes more sense.

Try this:

{{date add=(concat custom.Data.Timeout " days") to_tz="Autotask"}}

Got this:
Exception Message:

Exception: Text rendering error [Could not create interval from: ‘custom.Data.Timeout days’] while rendering template: {{date add=(concat custom.Data.Timeout " days") to_tz=“Autotask”}

Here is a screen shot in case that helps Awesome Screenshot

Can you send the URL to your history so I can see the logs? I’m intrigued now. :slight_smile:

I live to you intrigue you.

Thank you.

It turns out this is a defect on our side. The concat function is not correctly rendering the property it receives. We’ll push a fix ASAP.

In the meantime, if you set custom.Data.Timeout to include the “days” suffix (i.e. populate it with 3 days), then you can do this without using concat:

{{date add=custom.Data.Timeout to_tz="Autotask"}}

In any case, we’ll get this fixed as soon as we can.