---
title: "Update an issue only in certain conditions"
canonical: "https://support.appfire.com/space/JSUCLOUD/12518052/Update%20an%20issue%20only%20in%20certain%20conditions"
format: markdown
---
> Macro (aura-html)

---

Preconditions allow you to execute a post function only under certain circumstances. This helps you create more complex behaviors on your post functions, enabling Jira to do more work for you. In JSU for Jira Cloud, preconditions are part of the post function configuration. 

The following use case explains how to get started with JSU preconditions for post functions.

|  |  |
| --- | --- |
| **Goal** | Organize your budget approval issues |
| **Scenario** | *You want to organize your budget approval issues using a project component. *<br>We will use the Update Any Issue Field post function to set the issue component to Budget, ONLY IF:<br>- the issue summary contains the word `budget` and;
- the issue type is `Story`.<br>Let's have a look at how this can be automated using preconditions with JSU. |
| **Components** | - [Update Any Issue Field](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12518373) post function
- [Value Field precondition](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12518009)
- [JQL precondition](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12518033) |


## How to configure this rule

1. Create a draft of your project workflow. If you're unsure how to get to this page, follow the onboarding steps in [Edit a Jira Workflow](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12519274). You can then view your workflow in Text or Diagram mode. The steps in this use case represent Diagram mode. If you haven't already, switch the workflow viewer to Diagram mode.
2. <span style="color: #172b4d">We want our automation to be executed on the </span><span style="color: #172b4d">*Create*</span><span style="color: #172b4d"> transition, so we select the arrow that points to </span>[To Do] <span style="color: #172b4d">to display the </span><span style="color: #172b4d">*Options*</span><span style="color: #172b4d"> menu.</span>
3. <span style="color: #172b4d">Select </span><span style="color: #172b4d">**Post Functions**</span><span style="color: #172b4d"> then select </span><span style="color: #172b4d">**Add Post Function**</span><span style="color: #172b4d"> to display the list of available post functions.</span>
4. <span style="color: #172b4d">Select the </span><span style="color: #172b4d">*Update Any Issue Field (JSU)*</span><span style="color: #172b4d"> post function then select </span><span style="color: #172b4d">**Add**</span><span style="color: #172b4d"> at the bottom of the page.</span>
5. <span style="color: #172b4d">On the post function configuration page, select </span><span style="color: #172b4d">**Add Precondition**</span><span style="color: #172b4d">.</span>
6. We want our preconditions to ensure that only issues with issue type, *Story,* and a Summary containing `budget` text should be targeted for our post function execution.
  1. Add the Value Field precondition, and set `Issue Type = Story`
  2. Add the JQL precondition, and define a query to ensure that only issues containing `budget` in their summary will be found e.g. `key={issue.key} AND summary~budget`.   
  
:info: You can configure the above preconditions using only JQL. In this case, the search query would be: `key={issue.key} AND summary~budget AND issuetype=Story`. Use a configuration method that is simplest for you.  
:check_mark: Always include the query `key={issue.key}` (or similar) on your JQL condition. This ensures that JQL is performed on the current issue. For more details see [JQL Precondition](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12518033).
7. Configure the post function.
  1. *Preconditions must be*: set this to **True**.
  2. *Update field on all issues related as*: select **Within same issue**.
  3. Issue Field: select **Component**.
  4. Field Value: enter `Budget`.
8. Select **Add** at the bottom of the page.
9. Publish the workflow.

## Test the rule

1. To test our rule, we create an issue with issue type *Story* and call it *Budget for Hardware*. When we reload the issue, we can see that JSU updated it with the component `Budget`.
  

> ℹ️ Need more information or help? Check out the JSU topic for [workflow preconditions](https://appfire.atlassian.net/wiki/spaces/JSUCLOUD/pages/12518025).