Bulk updating date field based on comment text and date

Chris Ripley-Duggan November 14, 2023

Hi all,

We have a custom "Publication Date" field that I'm attempting to bulk populate. I'm looking to set that field to the date that a comment was added which features a particular URL.

 

I've already created a project-based automation to achieve this going forward, but now wondering if I can bulk update the ~300 existing tasks...I have a horrible feeling I cannot, but thought I would ask! Thank you!

1 answer

1 accepted

1 vote
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2023

Hello @Chris Ripley-Duggan 

Welcome to the Atlassian community.

I believe you can do this with a Scheduled automation rule.

Screenshot 2023-11-15 at 12.36.25 PM.png

Create a rule with the Schedule trigger and add to it a JQL that selects the issues you want to review. Uncheck the box that says to only pick issues that have changed since the last time the rule ran. It doesn't matter what schedule you set as long as it is in the future. You will be running the rule once manually and then disabling it.

Screenshot 2023-11-15 at 12.30.58 PM.png

 

Then add a For Each Advanced branch that will let you iterate through each issues comments.

Screenshot 2023-11-15 at 12.32.28 PM.png

Within the For Each branch add a Condition to check the comment body for the URL. Here I'm checking just for the presence of the text keyword.

Screenshot 2023-11-15 at 12.33.43 PM.png

This assumes you will have only one comment that has the matching text.

And then, still within the For Each branch, add an Edit action to edit the field in the issue using the created attribute of the comment. Here I just used a Log action to log the information to the rule audit log.

Screenshot 2023-11-15 at 12.35.23 PM.png

 

You will likely have to apply some formatting to the created data to get it in the right format to insert into the field in the issue.

 

After publishing the rule you can click the Run Rule button to run it immediately. After it completes, you can this disable it so it won't run again.

The For Each branch will be executed against each issue that is returned by the JQL in the Scheduled trigger.

Chris Ripley-Duggan November 15, 2023

Thank you for the extensive answer, Trudy! I really appreciate you putting this together. Going to try it out now!

Like Trudy Claspill likes this
Chris Ripley-Duggan November 15, 2023

Success! 🥳 Thank you so much @Trudy Claspill! This is going to save so, so much time!

Like Trudy Claspill likes this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2023

You're welcome!

Chris Ripley-Duggan November 16, 2023

Hi @Trudy Claspill 

Thanks again for this! It's saved me a load of time with tasks that have only mentioned "the keyword" once. I was wondering if you knew off the top of your head if it's possible for a smart value or advanced branching to look at the first instance of a comment with the keyword and then stop. As what I'm experiencing is it updating single tickets back and forth a few times before ending up on the latest comment.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 16, 2023

I don't know for sure that this would work, but you might try adding a condition to compare the formated Created date of the comment to your Publication Date field.

Screenshot 2023-11-16 at 11.51.31 AM.png

I have not tested this to see what it would do if the Publication Date was empty.

Like Chris Ripley-Duggan likes this
Chris Ripley-Duggan November 16, 2023

That definitely improved the results! You'll see it only ran through and updated the ticket twice on the latest run, compared to the 4x earlier. I'll keep tinkering and see what I can do!

Screenshot_1.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 16, 2023

Instead of using a straight comparison of the two fields I think you may want to use the diff function and compare that as greater than 0.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

Screenshot 2023-11-16 at 1.18.31 PM.png

 

Screenshot 2023-11-16 at 1.20.48 PM.png

If the current Comment Created date is 1 or more days newer than the date already recorded in Publication Date, then this condition should pass and the Publication date field should be updated.

I think you should probably also add a Re-fetch Issue action in the branch to ensure that if the Publication Date was updated once during the execution of the branch then the next loop through the branch will have the most recent data for the issue.

Screenshot 2023-11-16 at 1.24.04 PM.png

Like Chris Ripley-Duggan likes this
Chris Ripley-Duggan November 16, 2023

Thank you! I'm getting a "success" status in the audit log, but, that the Advanced Compare Condition did not match the condition.

Screenshot_2.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 16, 2023

An excellent tool for debugging rules is to use the Log action to print messages in the Audit Log for the rule execution. You can add your smart values to these actions to see what value Jira is getting for the smart value, to determine if it matches your expectations.

In this case I would add Log actions to print each date separately and then also the entire smart value used in the comparison. Smart values can be case sensitive and are space sensitive so make sure that what you use in a Log action matches exactly what you are using in Conditions and other actions.

(I can see what the problem is, but I'm trying to step you through how to figure it out so you'll have some tools for debugging future problems.)

Chris Ripley-Duggan November 17, 2023

I'll play with the Log action and see what I can get from that :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events