I'd like to update the "Start date" field of an issue to to the current date when somebody starts progress on it, but only if such an update wasn't done already (in the case the issue goes from in progress to done, then from in review back to to do). How would you do this with JMWE?
The field always has a value, since it's filled when doing the planning for a project with BigGantt's gantt chart. I'd like it to get automatically updated in case the issue is started before or after the originally planned date.
I thought of adding another boolean field (maybe a single choice select list) to the issue along the lines of "Start date was updated". The field wouldn't be actually displayed to users on any screens and would be false by default. Then in a JMWE Post Function I'd write some conditional Nunjuck script to update the date only if this field's value is false (and then also set "Start date was updated" to true).
Is there any easier way to do a conditional update like this? Do you see any issues with what I outlined?
Thank you in advance!
Hi Zoltán,
since you really cannot know where the current value of the "Start date" field comes from (BigGantt or the JMWE post-function), your idea of "memorizing" that you've been through the Start Progress transition before is the right one.
You can do this with a hidden custom field, that you set (using the Set Field Value post-function) on the Start Progress transition, with a small delay to make sure it runs after the other Set field Value post-function that sets the Start date field. Then you can test the value of that field in the conditional execution "script" of the latter.
You can also achieve the same using an "issue entity property" instead of a custom field. You can set the Issue Entity Property using the "Set entity property value" post-function (again with delayed execution), and test it in the conditional execution template using the issueProperty Nunjucks filter. The result will be the same but you won't clutter your custom fields page needlessly.
Thanks for the answer David, sounds perfect. I didn't know about entity properties, nor thought about having a delay, so important points.
I wondered why there is a second function needed to set the issue property, but it seems there's no way to set, just get the value of an issue property in Nunjuck, so I understand now.
I ended up doing this:
{{ now | date('tz') | date("YYYY-MM-DD") }}I used a condition for the Function:
{{ issue | issueProperty("StartDateWasSet") != "true" }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't need such a big delay - a couple of seconds is enough.
I agree delays are flaky, but unfortunately Jira Cloud triggers post-functions asynchronously so there's no good way to force any execution order.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.