Jira Automation - Edit Issue Fields Error
Asked by Sunny Liao:

Hello Community,

I am in the process of setting up an automation rule in Jira and could use some assistance. Here is the rule I'm trying to configure:

1. **If an issue was updated 2 weeks ago**: Send an email to the assignee and update each issues' field called "Email Sent" to 1.
2. **If an issue has not been updated for 4 weeks** : Send a follow-up email.  
   ![Screenshot 2024-08-23 135307.png](https://community.atlassian.com/t5/image/serverpage/image-id/343377i07354530E1DBC4DF/image-dimensions/294x460?v=v2 "Screenshot 2024-08-23 135307.png")

I've successfully set up the first part of the rule. However, I'm encountering an issue with the "Edit Issue Fields" action. Specifically, I am receiving the following error message:

*This component may be incompatible. One of the following needs to be produced earlier in the rule by the trigger or with a 'for each' branch for this component to work: Issue.*

Could anyone provide guidance on how to resolve this error or suggest a workaround? Your help would be greatly appreciated.

Thank you in advance for your support.


Answers:
author: Trudy Claspill
body: Hello [@Sunny Liao](/t5/user/viewprofilepage/user-id/5573906)

Welcome to the Atlassian community.

The problem is that you have created your branch based on Assignee, so the actions in the branch don't have a pointer to a specific issue to update.

Are you trying to send each Assignee one email listing all the relevant issues, or are you trying to send each Assignee one email for each issue?

comments: author: Sunny Liao
body: I am trying to send each assignee an email listing all the relevant issues assigned to them. For each of these issues, I will update the "Housekeeping Email Sent" field to 1. This will create a record indicating that the issue has been notified to the assignee.

In the second round, if an issue has not been updated for 4 weeks, we will send a follow-up email. At that point, we will filter the issues to include only those with the "Housekeeping Email Sent" field set to 1.


author: Trudy Claspill
body: Thank you for the clarification.

You need to, essentially, branch to each issue found in the Lookup Issues to update the issue.

However, you cannot create a branch within a branch.

One small change I would recommend is in your first Lookup add to the JQL the criteria **Assignee is not empty**. That will prevent the second branch from trying to execute for the unassigned issues.

I think one solution would be for you to add another branch in parallel to the Assignee branch you have currently. For this other branch, branch on the smart value for distinct **key** values in the first Lookup Issues results and have an action to update the Housekeeping Email Sent field.


author: Sunny Liao
body: ![Screenshot 2024-08-26 092635.png](https://community.atlassian.com/t5/image/serverpage/image-id/343716i1B1FB1CF97747819/image-size/large?v=v2&px=999 "Screenshot 2024-08-26 092635.png")  
Thank you [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011)   

I have tried to create another branch and set {{lookupIssues.key}} as the Smart value, however the edit issue is still having error.   

May I know why? and how to fix it?


author: Bill Sheboy
body: Hi [@Sunny Liao](/t5/user/viewprofilepage/user-id/5573906)

Adding to the suggestions from Trudy...

You describe checking for **updates to issues within a time frame** , **send only one email** communication per assignee spanning their issues, and then **update the issues**.

There is no nested branching to support a scenario like this. As Trudy described, your branch on the distinct assignee does not provide an issue for the Edit Issue action.

I can think of two ways to solve this:

* Ignore the requirement to send only one email, as the trigger is the issue update and those are distinct. Thus an assignee will get one email per issue.
* Use two rules...
  * Modify your first rule to use the Send Web Request action to trigger an [Incoming Webhook rule](https://support.atlassian.com/cloud-automation/docs/jira-automation-triggers/#Incoming-webhook). This first rule will send the assignee information in the action.
  * In that second rule, use the passed assignee information with a Lookup Issues action to find the issues and send the email. Then branch over the issues to update them.
  * If you want to try this approach, here is a how-to article for using the Send Web Request action: <https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828>

Kind regards,  
Bill


Tags: cloud

jira-cloud