# Dynamic ("Calculated") Values in Campaign Actions

**URL:** <https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736>\
**Category:** Ideas and Feature Requests\
**Tags:** campaigns\
**Created:** [April 1, 2020, 2:46pm UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736 "2020-04-01T14:46:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ekke/32/296_2.png) [@ekke](https://forum.mautic.org/u/ekke)\
**Post date:** [April 1, 2020, 2:46pm UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/1 "2020-04-01T14:46:30Z")

</div>

My idea is: Let’s finally allow Mautic users to use calculated values in campaign steps. E.g.

- “Update contact field with current time & date” or maybe even

- “Update contact field with value from elsewhere (e.g. from a different field)”

- and maybe beyond contact data  
Not sure if we should start with the most important flavours, “hard-coded” - or if we should come up with a sophisticated general framework. Maybe we can fid something in between. 🙂

I think these groups of people would benefit from this idea:

Why I think they would benefit from this idea:

Any code or resources to support this idea:

Are you willing to work on this idea?: Yep

What skills and resources do you need to explore this further?

---

<div class="post-metadata">

**Author:** ![ledzee](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ledzee/32/4252_2.png) [@ledzee](https://forum.mautic.org/u/ledzee)\
**Post date:** [May 27, 2021, 5:01am UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/3 "2021-05-27T05:01:24Z")

</div>

This would be a great feature.

Some of the use cases of calculated fields I can think about are as follows:

1. A formula field that could do a timestamp on a field when another field changes
2. A formula field that could follow a logic of if, then…
3. A formula that could do math operation (+,-,\*,/) as well as functions like SUM, AVG, MEAN, MEDIAN

---

<div class="post-metadata">

**Author:** ![thangsanps](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/thangsanps/32/667_2.png) [@thangsanps](https://forum.mautic.org/u/thangsanps)\
**Post date:** [June 2, 2021, 8:55am UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/4 "2021-06-02T08:55:17Z")

</div>

I am in need of (+,-,\*,/) fields. Anyone have a solution for this?

---

<div class="post-metadata">

**Author:** ![peter\_k](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/peter_k/32/511_2.png) [@peter\_k](https://forum.mautic.org/u/peter_k)\
**Post date:** [January 13, 2022, 8:17pm UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/5 "2022-01-13T20:17:48Z")

</div>

This would be a very nice feature.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [January 6, 2026, 4:52pm UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/6 "2026-01-06T16:52:04Z")

</div>

@ekke we discussed this in the release planning meeting - some of these features are implemented for forms:

> <https://github.com/mautic/mautic/pull/14100>
>
> | Q | A
> | --------------------------------…------ | ---
> | Bug fix? (use the a.b branch) | 🔴 
> | New feature/enhancement? (use the a.x branch) | 🟢
> | Deprecations? | 🟢
> | BC breaks? (use the c.x branch) | 🔴
> | Automated tests included? | 🟢 
> | Related user documentation PR URL | https://github.com/mautic/user-documentation/pull/317
> | Related developer documentation PR URL | mautic/developer-documentation-new#... 
> | Issue(s) addressed | Fixes #... 
> 
> 
> 
> \## Description
> 
> This PR adds the possibility to add dynamic date time values as \*\*default value\*\* to \`date\`, \`datetime\` and \`hidden\` input fields.
> You can use any string described in https://www.php.net/manual/en/datetime.formats.php for setting dynamic date values.
> 
> \#### For \`date\` and \`datetime\` fields
> 
> For \`date\` and \`datetime\` fields Mautic will try to parse any string as a date. The only exception is an empty string (which PHP would normally parse as \`now\`. If parsing fails the default value will be left as-is.
> 
> \- Default values for \`date\` fields will be formatted in \`Y-m-d\`.
> \- Default values for \`datetime\` fields will be formatted in \`Y-m-d\\TH:i\`.
> 
> \*\*Example:\*\*
> 
> \- \`now\`
> \- \`today +2 days 4am\`
> \- \`2025-05-04 \`
> \- \`2025-05-04 14:30\`
> 
> \#### For \`hidden\` fields
> 
> For \`hidden\` fields Mautic will try to parse any (non-empty) string as a date \*\*if it ends with \`|date\`\*\*. Adding this (twig-like) suffix was done to prevent accidentally parsing meaningful strings as date. For example a hidden field with \`4am\` might bear some meaning besides referring to \`today at 04:00\`.
> 
> \- Default values for \`hidden\` fields will be formatted in \`Y-m-d\\TH:i\`. There is no option to change this.
> 
> If parsing fails the default value will be left as-is.
> 
> \*\*Example:\*\*
> 
> \- \`now|date\`
> \- \`today +2 days 4am|date\`
> \- \`2025-05-04 |date\`
> \- \`2025-05-04 14:30|date\`
> 
> 
> 
> 
> 
> \## Use cases
> 
> \- Setting relative dates in input fields
> \- Recording the date and time a form was submitted in a custom contact field
> 
> \---
> \### 📋 Steps to test this PR:
> 
> 
> 1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs \[here\](https://contribute.mautic.org/contributing-to-mautic/tester))
> 2. Create or edit a form
> 3. Add date, datetime or hidden input fields
> 4. Set the default value to any datetime parsable string. Append \`|date\` for hidden fields.
> 5. Open the form and inspect the html code
> 6. See that the default values are replaced by actual date time values

So we could perhaps repurpose some of this.

Is it still a feature you’re looking for Mautic to implement?

---

<div class="post-metadata">

**Author:** ![ekke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ekke/32/296_2.png) [@ekke](https://forum.mautic.org/u/ekke)\
**Post date:** [January 22, 2026, 6:55am UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/7 "2026-01-22T06:55:27Z")

</div>

Absolutely, we’d still love to see it, but not invest time atm (other priorities like email builder and form types)  
@silavapi

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [January 22, 2026, 10:13am UTC](https://forum.mautic.org/t/dynamic-calculated-values-in-campaign-actions/13736/8 "2026-01-22T10:13:08Z")

</div>

OK thanks for responding, just wanted to check in as it was a long time back!
