<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jodocus on Medium]]></title>
        <description><![CDATA[Stories by Jodocus on Medium]]></description>
        <link>https://medium.com/@jodocus?source=rss-30b16d0b9429------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gKX-xL1UrhgwdBuL.png</url>
            <title>Stories by Jodocus on Medium</title>
            <link>https://medium.com/@jodocus?source=rss-30b16d0b9429------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 06:33:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jodocus/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building a Hiring Process with Dynamic Approvals]]></title>
            <link>https://medium.com/jodocus-blog/building-a-hiring-process-with-dynamic-approvals-2f4f10159d61?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f4f10159d61</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[process]]></category>
            <category><![CDATA[hr]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Mon, 04 Nov 2019 16:31:01 GMT</pubDate>
            <atom:updated>2020-05-11T14:30:42.512Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3aZxoHBFVzYBGZJ8" /><figcaption>Photo by <a href="https://unsplash.com/@helloimnik?utm_source=medium&amp;utm_medium=referral">Hello I&#39;m Nik 🇬🇧</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It’s no secret that Jira is just as useful for administrative processes within the company as it is for development and IT teams. It can help you to keep track of who does what by when. Whether it’s <a href="https://www.atlassian.com/company/events/summit/watch-sessions/2019/beyond-tech-teams-use-cases/ditch-excel-and-jumpstart-your-business-processes-with-jira-software">Legal</a>, <a href="https://www.atlassian.com/company/events/summit/watch-sessions/2019/beyond-tech-teams-use-cases/hr-on-boarding-made-easy-how-fair-manages-hypergrowth-with-jira">HR</a>, or even <a href="https://www.atlassian.com/company/events/summit/watch-sessions/2019/beyond-tech-teams-use-cases/a-very-atlassian-journey-through-sox-compliance">Compliance</a> — Jira is essential for effective workflows. And with our app <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows?hosting=cloud&amp;tab=overview">Cloud Workflows</a>, we at <a href="https://jodocus.io/indexEN.html">Jodocus</a> aims to improve these workflows even more.</p><h3>Simple hiring workflow</h3><p>In this article, we would like to show you how easy it is to add approvals to a Jira Cloud workflow with <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows"><strong>Cloud Workflows</strong></a>. We will use an HR process as an example, but really this approach can be used to improve all kinds of workflows. Let’s take a look at a prototypical hiring workflow that applies to a specialised issue type called <strong>Hiring Candidate</strong>. Each issue represents a potential new hire and has a number of custom fields to contain additional information about the candidate. For our example we will especially look at two of those fields: The candidate’s name and future salary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*E_NpZ1WyKnB_AiLCoQp8XQ.png" /><figcaption>A simple hiring workflow</figcaption></figure><p>Whenever a candidate has been identified, an issue is created with the status <strong>Open</strong>. When an offer to the candidate is prepared, the status changes to <strong>Decision Pending</strong>. The next step is to send the offer out to the candidate and wait for their response. Depending on the candidate’s response the workflow either ends with <strong>Accepted</strong> or <strong>Declined</strong>. And as long as no offer has been sent to the candidate, there is also the option to cancel the hiring process.</p><p>In some cases, we want an extra approval step in this workflow. More specifically, we want an extra approval when the candidate’s salary is going to be higher than $100,000. This article will show you an easy way to set up such an approval with <a href="http://marketplace.atlassian.com/apps/1220407/cloud-workflows">Cloud Workflows</a>.</p><p>First, let us look at the specific requirements:</p><ol><li>Any candidate with a salary higher than $100,000 needs an extra approval</li><li>The approval needs to be given in the form of a sub-task that is closed with the resolution ‘Approved’</li><li>The approval needs to be in place before the offer can be sent to the candidate</li></ol><h3>Creating the approval sub-task</h3><p>Requirements number one and two can be implemented with a post function that creates a sub-task. But that post function should only be triggered in some cases, so that means we need conditional execution. Fortunately, that’s easy with Cloud Workflows, here’s what it would look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yUsmkQkRnw_rHv0HMzfOBA.png" /><figcaption>Automatically creating a sub-task when a condition is met</figcaption></figure><p>In the example above, we assume that the salary is held in a custom field of the original issue with the id 98765. We make Jira check whether the number in that field is higher than 100,000 and only if that is the case, the sub-task will be created.</p><p>When creating the sub-task, a few fields will be copied, but we do want to change the summary in order to make it clear what this is about. Since Cloud Workflows allows us to use templates, we set the summary to:</p><p>High salary approval for $candidate ($issue.custom_field9876543)</p><p>Which will create sub-tasks with summaries such as: ‘High salary approval for Humphrey Smith ($890.000)’ whenever an offer with an exceptionally high salary is prepared.</p><h3>Ensuring that approval has been given</h3><p>Before an offer is sent to a candidate, we need to be sure that an approval has been given — easy, just use the <em>Sub-Task Blocking Condition </em>that comes with Jira. That condition will check if there are any sub-tasks and if those sub-tasks are in a state that allows the transition. While this might work, it is prone to errors; for example an issue could have multiple sub-tasks none of which are related to the high salary approval.</p><p>So, in order to make sure that the approval requirement only applies to candidates with a salary higher than $100.000, we will build a custom condition that performs more detailed checks:</p><ul><li>Is the salary in customfield_98765 above $100,000?</li><li>Is there a sub-task with a summary starting with ‘High salary approval’?</li><li>Is that sub-task closed with the resolution ‘Approved’?</li></ul><p>All of which can be done with this Jira Expression:</p><pre>issue.customfield_98765 &lt; 100000 <br>|| <br>issue.subtasks.filter(s =&gt; s.summary.includes(&quot;High salary approval&quot;))[0].resolution.name == &#39;Approved&#39;</pre><p>Why would you take this approach? It makes absolutely sure that the approval process has been followed, even if one of the previous steps has failed for any reason (ex. the approval sub-task not being created or removed). Building checks like this is also essential when creating compliance processes or workflows, but that is a topic for another day.</p><h3>Putting it all together</h3><p>In this article we have seen how <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows?hosting=cloud&amp;tab=overview">Cloud Workflows</a> makes it so much easier to automate parts of a process by automatically creating sub-tasks for you. And we have seen how you can enforce that process restrictions (i.e. mandatory approvals) are followed without much hassle; simply by setting up a workflow condition that checks exactly the required restrictions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f4f10159d61" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/building-a-hiring-process-with-dynamic-approvals-2f4f10159d61">Building a Hiring Process with Dynamic Approvals</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JQL Queries for the Jira Expression Tester]]></title>
            <link>https://medium.com/jodocus-blog/jql-queries-for-the-jira-expression-tester-c572b9dc7285?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/c572b9dc7285</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[jira-cloud]]></category>
            <category><![CDATA[atlassian]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 11:52:24 GMT</pubDate>
            <atom:updated>2019-09-16T09:41:00.112Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8qbD75x_jg8VHqBX" /><figcaption>Photo by <a href="https://unsplash.com/@fabioha?utm_source=medium&amp;utm_medium=referral">fabio</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We just launched a new feature and could not be more excited! <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">Cloud Workflows</a> now supports JQL queries in the Jira Expression tester and it is super easy to use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f36-qyVQ9z9XrH-AAus4Fg.png" /><figcaption>Just add your own favourite query</figcaption></figure><p>Just click the ‘Open JQL Query Editor’ button and enter a JQL query of your choice and you are done. The result of your JQL query is available to your Jira Expression as a list of issues called issues.</p><p>Alright, so why is this exciting and what can you do with it? We already wrote about the power of <a href="https://medium.com/@jodocus/jira-expression-of-the-week-data-aggregation-4dd5e235e113">Jira Expressions when aggregating data</a> and now you can tap into that power straight from the Jira UI. But aggregating data is not everything you can do with the combination of JQL and Jira Expressions. You can just as easily selectively extract data from a set of issues. Want to prepare a list of issue keys and their respective summaries in a sprint for your release Notes? This now becomes really easy to do:</p><pre>JQL Query:<br>project = ‘Cloud Workflows’ AND sprint = ‘Sprint 12’</pre><pre>Jira Expression:<br>issues.map(i =&gt; i.key + &quot; &quot; + i.summary )</pre><p>And it looks pretty, too:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlhbq4fs9MLN3OXhrHBodA.png" /><figcaption>Results now come with prettified JSON</figcaption></figure><p>Neat, eh? We are sure you will have as much fun with this new feature as we are having and we cannot wait to get your <a href="/service/mailto: apps@jodocus.io">feedback</a>! So go ahead and <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">give it a try</a> today!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c572b9dc7285" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jql-queries-for-the-jira-expression-tester-c572b9dc7285">JQL Queries for the Jira Expression Tester</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jira Expression of the week — Pushing the limits]]></title>
            <link>https://medium.com/jodocus-blog/jira-expression-of-the-week-pushing-the-limits-1604f133bc70?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/1604f133bc70</guid>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[jira-cloud]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Thu, 15 Aug 2019 14:36:33 GMT</pubDate>
            <atom:updated>2019-11-10T21:15:39.345Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira Expression of the week — Pushing the limits</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UIQvFdF7i237-5fB" /><figcaption>Photo by <a href="https://unsplash.com/@vikram46?utm_source=medium&amp;utm_medium=referral">vikram sundaramoorthy</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This week’s article concludes our series on Jira Expressions. Over the last weeks, we have <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-1-fecdbddf429d">looked at</a> <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-2-c88e1f401059">a lot of</a> <a href="https://medium.com/@jodocus/jira-expression-of-the-week-separation-of-concerns-fb68923ca538">different</a> <a href="https://medium.com/@jodocus/jira-expression-of-the-week-feature-freeze-5f8cdaaf6f22">expressions</a> and you have hopefully become as convinced as we are that Jira Expressions are one of the coolest new features in Jira Cloud. But there is one topic left that we have to discuss:</p><p>The limitations of Jira Expressions and how they might affect you.</p><p>Do not worry, the limits have been set rather generously, so that you might never come up against them in real-life. Still, it’s good to know where the limits are. The <a href="https://developer.atlassian.com/cloud/jira/platform/jira-expressions/#restrictions">documentation</a> for Jira Expressions lists the following restrictions:</p><ul><li>Maximum number of results</li><li>No more than 1.000 characters</li><li>No more than 100 syntactic elements</li><li>No more than 10 expensive operations</li></ul><h3>Maximum number of results</h3><p>At most 10,000 primitive values or 1,000 Jira REST API beans will be returned. In most use-cases for Jira Expression, this limitation will not affect you at all and it is virtually a non-issue when using Jira Expressions for custom conditions and validators with <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">Cloud Workflows</a>. It can be more of a limitation when using Jira Expressions for data retrieval and aggregation (as we have done last week), so plan ahead and include some error handling in your scripts or use JQL if you expect high numbers of results.</p><h3>No more than 1.000 characters</h3><p>Just one thousand characters might sound low, but this limit is hard to hit in real life. The longest expression in this series was the <a href="https://medium.com/@jodocus/jira-expression-of-the-week-data-aggregation-4dd5e235e113">data aggregation</a> with a length of 154 characters. If we had tried to trim further down we easily could have pushed that number down to 127 characters. In any case, you will hardly ever get close to the limit, try cutting variable names to one letter — in the data aggreation example that alone would have shortened the expression by 17%!</p><h3>No more than 100 syntactic elements</h3><p>A syntactic element is pretty much anything that cannot be divided further. <br>This includes:</p><ul><li>Comparative operators like !=, ==, &lt;, &gt;</li><li>Conjunction like || (or) and &amp;&amp; (and)</li><li>Accessing an attribute or a data point, like issue.created</li></ul><p>As you can imagine this is also hard to hit, even though it is easier to come up against than the 1,000 character limit. Here is one (admittedly silly) example that would exceed this limit:</p><pre>issue.id != issue.id || issue.id != issue.id || issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.id ||issue.id != issue.comments.length</pre><p>As you can see, 100 syntactic elements should be more than enough for any use-case.</p><h3>No more than 10 expensive operations</h3><p>This is the one you are most likely to hit. Anything that loads additional data counts as an expensive operation. In practise this typically are comments, linked issues or sub-tasks, properties and customfields, loading any of those will count against this limit. Here is an example of how quickly this limit can be hit:</p><pre>issue.comments.map(commentOfIssue =&gt; { <br>    authorOfTheComment: commentOfIssue.author.displayName, <br>    propertiesOfTheComment: commentOfIssue.properties.length<br>})</pre><p>Whether the above expression will run successfully depends on the number of comments that have been made on the issue. Getting the issue is the first expensive operation, getting the comments the second one. Getting the properties of the comments counts as one expensive operation per comment. Hence, this expression will fail due to exceeding the limit if there are more than eight comments on an issue.</p><h3>Conclusion</h3><p>As we have seen, most of the limitations have been set so generously that they hardly ever will play a role in real life. Still, it is a good idea to <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows?hosting=cloud&amp;tab=overview">test your expressions</a> with different issues to avoid any surprises in production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1604f133bc70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jira-expression-of-the-week-pushing-the-limits-1604f133bc70">Jira Expression of the week — Pushing the limits</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jira Expression of the week — Data Aggregation]]></title>
            <link>https://medium.com/jodocus-blog/jira-expression-of-the-week-data-aggregation-4dd5e235e113?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dd5e235e113</guid>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[jira-cloud]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Mon, 05 Aug 2019 16:07:36 GMT</pubDate>
            <atom:updated>2020-08-07T14:16:13.815Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira Expression of the week — Data Aggregation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uEH_3_OtJq14uH46" /><figcaption>Photo by <a href="https://unsplash.com/@adeolueletu?utm_source=medium&amp;utm_medium=referral">Adeolu Eletu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So far, we mainly concentrated on using Jira Expression to build custom validators or conditions for fine-grained workflow control. But Jira Expressions can do more than that. Today, we will do some data aggregation with Jira Expressions in a real-world scenario. In fact, just like last week’s <a href="https://medium.com/@jodocus/jira-expression-of-the-week-feature-freeze-5f8cdaaf6f22">Feature Freeze</a>, this is something we are using ourselves here at <a href="https://jodocus.io/en">Jodocus</a>.</p><p>There is always a lot to do at a startup and it is sometimes hard to keep up with who does what. Using Jira helps a lot, but we also wanted to have something delivered to our inbox at regular intervals. And so the idea for our weekly e-mail report was born which — among other things — helps us understand how work is distributed among the team, e.g. if there is someone who has a disproportionate amount of issues to their name. This information can easily be retrieved using a Jira Expression: This week’s Jira Expression of the week.</p><h3>How is work distributed among the team?</h3><p>OK, we want to know how issues are distributed among the team. We are not interested in work that’s already finished, so we do not care about closed issue. Also, we do not care about unassigned issues; they only become relevant for this report once they have been assigned to a team member. Getting a list of these issues is actually pretty easy with a short <a href="https://confluence.atlassian.com/jiracore/blog/2015/07/search-jira-like-a-boss-with-jql">Jira Query Language (JQL</a>) statement:</p><p>assignee != null and status != Closed</p><p>But instead of a long list of issues, we want something like this:</p><figure><img alt="A pie chart showing distribution of issues" src="https://cdn-images-1.medium.com/max/882/1*mGafdkjNjiKs9VmAAtEDRQ.png" /><figcaption>Distribution of assigned Issues</figcaption></figure><p>Basically, what we need for our graphic is a so-called <em>map of aggregated data</em>. A <em>map</em> is a data structure that stores key-value pairs. In this example, the name serves as a key, while the number of issues assigned to a person is the value. It would look something like this:</p><pre>“value”: {<br>  “John Doe”: 14.0,<br>  “Jane Doe”: 22.0,<br>  “Humphrey Smith”: 40.0,<br>  “Oliver Siebenmarck”: 47.0,<br>  “Dogbert”: 4.0<br> }</pre><p>To get these numbers, we will use <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/">Jira Cloud’s REST API</a> which conveniently has an <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-expression-eval-post">endpoint</a> for Jira Expressions, allowing us to execute a Jira Expression in the context of a list of issues, which is defined by a JQL query. Exactly what we need!</p><blockquote>You do not need any extra apps to follow along — everything can be done via the Jira Expression <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jira-expressions/#api-rest-api-2-expression-eval-post">REST API</a>. However, the easiest way to work with Jira Expressions is to use our free app, <a href="https://marketplace.atlassian.com/apps/1223058/expression-tester?hosting=cloud&amp;tab=overview&amp;utm_source=medium&amp;utm_medium=article&amp;utm_campaign=et_launch">Expression Tester</a>. You can install the Expression Tester from the <a href="https://marketplace.atlassian.com/apps/1223058/expression-tester?hosting=cloud&amp;tab=overview&amp;utm_source=medium&amp;utm_medium=article&amp;utm_campaign=et_launch">Atlassian Marketplace</a>.</blockquote><p>This week’s expression is a bit on the longer side, but don’t worry, we will take it step by step:</p><pre>issues.reduce(<br> (result, issue) =&gt; <br>    result.set( <br>      issue.assignee.displayName, <br>     (result[issue.assignee.displayName] || 0) + 1)<br>  , new Map())</pre><p>When we use the REST API with a JQL query, Jira will place the resulting issues in a list and make that available to our expression as issues. That list contains a lot more data than we want, so we need to reduce it a bit. Jira Expressions allow us to do that with the reduce()-function. In this example, it takes two arguments: a function to apply to all issues and a <em>map</em> of the results. <br>The <em>map</em> is easy to spot, that’s the new Map() part in the last line. The function definition is pretty much the remainder of the expression, here again for clarity:</p><pre>(result, issue) =&gt; <br>  result.set( <br>   issue.assignee.displayName, <br>   (result[issue.assignee.displayName] || 0) + 1)</pre><p>Jira will now run this function for every issue in the list of issues. When it is run for the first issue result will be the newly created (and thus empty) Map, but we will add data to it for every issue. That is what the set()-function does. It takes a key-value pair and adds it to a map. If the key already exists, its value is overwritten with the new value.<br>As the key we use the assignee’s name, that’s pretty straight forward. Getting the correct value is a bit more elaborate: Every time we run set() for a specific user’s name, we want to add one to the value that’s already listed there. But how? Well, with result[issue.assignee.displayName] we get the current number to which we add one with + 1. Of course, this will not work the first time we count an issue for a user: There is no previous value. That’s the what the || 0 part of (result[issue.assignee.displayName] || 0) helps us with. As you might have guessed|| is a logical OR. Here, it basically says: <em>either use the number from </em>result[issue.assignee.displayName]<em> or, failing that, use zero.</em></p><p>And that’s already everything there is to it. When sending this week’s expression to the REST API, this is the result:</p><pre>{<br>    &quot;meta&quot;: {<br>        &quot;issues&quot;: {<br>            &quot;jql&quot;: {<br>                &quot;count&quot;: 127,<br>                &quot;maxResults&quot;: 1000,<br>                &quot;startAt&quot;: 0,<br>                &quot;totalCount&quot;: 127<br>            }<br>        }<br>    },<br>    &quot;value&quot;: {<br>       “John Doe”: 14.0,<br>       “Jane Doe”: 22.0,<br>       “Humphrey Smith”: 40.0,<br>       “Oliver Siebenmarck”: 47.0,<br>       “Dogbert”: 4.0<br>    }<br>}</pre><p>Exactly what we set out to retrieve. At Jodocus, we use this data to build the pie chart from above, but of course any other visualization is possible, such as this bar chart:</p><figure><img alt="A bar chart showing distribution of issues" src="https://cdn-images-1.medium.com/max/619/1*NSHYx64FnTttZCaaavuMKw.png" /><figcaption>Bar chart of assigned issues</figcaption></figure><p>As you can see, aggregating data with Jira Expressions is rather easy, can be super-useful, and yields great results with very little effort. Do you use Jira Expression in your organization? Let us know! And come back next week, when we take a look at how to work with custom fields.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dd5e235e113" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jira-expression-of-the-week-data-aggregation-4dd5e235e113">Jira Expression of the week — Data Aggregation</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jira Expression of the week — Feature Freeze]]></title>
            <link>https://medium.com/jodocus-blog/jira-expression-of-the-week-feature-freeze-5f8cdaaf6f22?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f8cdaaf6f22</guid>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[jira-cloud]]></category>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[workflow]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Mon, 29 Jul 2019 15:38:43 GMT</pubDate>
            <atom:updated>2020-05-11T14:33:02.247Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira Expression of the week — Feature Freeze</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*trs7YpLdnUEKlfqn" /><figcaption>Photo by <a href="https://unsplash.com/@epw615?utm_source=medium&amp;utm_medium=referral">erin mckenna</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here at <a href="https://jodocus.io/en">Jodocus</a>, our development team works in sprints as do many of our clients. We have one particular rule that really has been working well for us: When a sprint nears its end, we disallow starting work on new issues, even though they have been planned for the sprint. We call it a (mini) Feature Freeze.</p><p>Today, we’ll look at the validator we implemented to ensure the Feature Freeze. First though, have a look at our workflow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fZziy0vVwVBntRVFg1cJxA.png" /><figcaption>Our basic workflow</figcaption></figure><p>Stories start in Backlog and stay there until we schedule them for a sprint. Once they are scheduled for a sprint, the status changes to “Selected for Development”. However, the transition to “In Progress” (indicating that actual work is starting) is only allowed to happen if a) the Story is part of the current sprint <strong>and</strong> b) the end of the current sprint is more than three days in the future. If the sprint’s end is closer, we do not want anyone to start new work. To enforce this behaviour, we have created a Jira Expression that checks both conditions, a) and b). We have then created a custom Validator using <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">Cloud Workflows</a> and assigned it to the “Start Working” transition. This expression is our <em>Jira Expression of the week</em>.</p><p>Now, this week’s expression is quite a bit longer than the ones you have seen in the <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-1-fecdbddf429d">first</a> <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-2-c88e1f401059">three</a> <a href="https://medium.com/@jodocus/jira-expression-of-the-week-separation-of-concerns-fb68923ca538">articles</a>. There are three parts to this week’s expression: First, making sure the issue is in the current sprint. Second, ensuring the current date is more than three days away from the end of the sprint and finally a way to link these two parts together, so that they both must be true for the validator to pass. Let’s break it down and look at the three parts one by one.</p><h3>The issue must be in an active sprint</h3><p>Software projects in Jira can be organized into sprints with each issue either being assigned to a sprint or the backlog. Sprints usually happen sequentially, but can in certain circumstances overlap or even happen simultaneously. In Jira Expressions every issue has an attribute sprint that either refers to the sprint the issue is assigned to or contains the value null if the issue has not been assigned to a sprint. Looking at the Jira Expressions reference documentation, we quickly find that sprints have a state attribute which can be either future, active or closed. You can probably guess what they each refer to: ‘future’ is any sprint that has not started yet, closed is any sprint that has already finished and sprints that are currently being worked on are active. So, the first part of our expression comes to:</p><pre>issue.sprint.state == ‘active’</pre><h3><strong>The sprint’s end date must be further than three days away</strong></h3><p>To ensure this part, we need to know today’s date, which is rather easy, as a newly created date object always represents today. All we need to get today’s date is:</p><pre>new Date()</pre><p>We just saw how to access the state attribute of the issue’s sprint. A sprint also has an endDate attribute, from which we can count backwards three days with minusDays(3). The minusDays(x) function subtracts x days from a date. Naturally, there is also a corresponding plusDays(x) function that adds x days.<br>As long the newly calculated date is greater than today (ie in the future), we are still far away enough from the end of the sprint to start working on the issue. We can express this like this:</p><pre>issue.sprint.endDate.minusDays(3) &gt; new Date()</pre><h3>Linking two parts of an expression</h3><p>By now we have two Expressions that both work perfectly well on their own, but we want to link them up so that we just need one validator. The good news is, that this is pretty easy to do with a logical AND-operator; in Jira Expressions that’s &amp;&amp;. So, linking the two parts simply looks like this:</p><pre>issue.sprint.state == ‘active’ <br>&amp;&amp; <br>issue.sprint.endDate.minusDays(3) &gt; new Date()</pre><p>The expressions on the two sides of the &amp;&amp; both must be met in order for the whole expression to become true and allow the transition to take place. In plain English: Work on an issue can only be started if the issue is assigned to a sprint that is in the active state (line 1), this sprint’s end date must be at least three days away (line 3) and both conditions must be met (line 2).</p><h3>Conclusion</h3><p>And here it is, our Feature Freeze Validator:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tP5TWVsEN1vKcEwMCPm9jA.png" /><figcaption>Feature Freeze Validator</figcaption></figure><p>Next week, we will look at how to aggregate data with Jira Expressions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f8cdaaf6f22" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jira-expression-of-the-week-feature-freeze-5f8cdaaf6f22">Jira Expression of the week — Feature Freeze</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jira Expression of the Week — Separation of Concerns]]></title>
            <link>https://medium.com/jodocus-blog/jira-expression-of-the-week-separation-of-concerns-fb68923ca538?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb68923ca538</guid>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[jira]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Thu, 18 Jul 2019 15:17:40 GMT</pubDate>
            <atom:updated>2020-05-11T14:34:09.285Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira Expression of the Week — Separation of Concerns</h3><p>Our clients quite often have very specific requirements around their processes, with a lot of restrictions to apply. For this week’s Jira Expression, we will look into how one rather common of these restrictions can be implemented: A separation of concerns. The restriction is: An issue may not be transitioned to the next state if it is owned by the same owner as its parent. For example, a Product Owner who owns a Story should not be able to put the corresponding Tasks to In Progress.</p><p>To enforce this restriction in a workflow, we will use a custom workflow condition with a Jira Expression that returns either true or false, just like the one from <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-2-c88e1f401059">last week</a> did.</p><blockquote>To use a custom condition like the one described in this article, you will need a Jira Cloud app that supports conditions. We suggest <a href="http://marketplace.atlassian.com/apps/1220407/cloud-workflows"><strong>Cloud Workflows</strong></a> which brings new <strong>conditions </strong>and <strong>validators </strong>to Jira Cloud! Thanks to either our easy templates or your custom <strong>Jira Expressions</strong>, you gain more fine-grained control of your workflows. Our flexible <strong>post-functions </strong>further enhance your workflow’s productivity. It’s available from the <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">Atlassian Marketplace</a>!</blockquote><p>To build our expression, we need to know just a couple of things:</p><ul><li>The user who or attempts to perform the transition</li><li>The assignee of the parent issue</li></ul><blockquote>We will use the accountId to identify a user in Jira, even though other options are available. The <em>accountId</em> is guaranteed to be unique and available throughout Atlassian’s API and does not have the privacy concerns that apply to other attributes such as the user’s e-mail address. See <a href="https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/?_ga=2.37174569.844622782.1562497368-1553409358.1561536968&amp;source=post_page---------------------------#testing-your-gdpr-changes">here</a> for more information.</blockquote><p>By this point, you should already be familiar with the information available in the current issue, but can go ahead and check out <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-1-fecdbddf429d">part 1</a> and <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-2-c88e1f401059">part 2</a> of this series.</p><p>We will use the user-object to get the current user’s accountId. As you might have guessed, the user-object holds information about the user performing the transition (whereas current assignee’s name does not help us that much since it is possible that someone else is trying to perform the transition).</p><pre>user.accountId</pre><figure><img alt="Accessing the current user’s accountId" src="https://cdn-images-1.medium.com/max/526/1*kAF7rWa7vAOv5lH-ZKDKfQ.png" /><figcaption>Accessing the current user’s accountId</figcaption></figure><p>Of course, the output here is some random-looking id, but it is guaranteed to be a unique identifier of the current user. We are halfway there, yippie!</p><p>Next up, we need the assignee of the parent issue. Unfortunately, there is no parentIssue-object directly available in the context. Or is there? A quick look at Atlassian’s <a href="https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference/#project">reference documentation</a> tells us that issues have an attribute called parent. Which — you guessed it — is just another issue-object, only that it represents the parent of the issue:</p><pre>issue.parent.assignee.accountId</pre><figure><img alt="Accessing the parent issue’s assignee" src="https://cdn-images-1.medium.com/max/527/1*HM0-U7LoSnuoSIt6dsuwJw.png" /><figcaption>Accessing the parent issue’s assignee</figcaption></figure><p>Almost done, the only thing left is to compare both assignees. Jira Expressions give us a range of options, but for now we only need one: != which translates to does not equal. (The opposite would be ==, which we would have used if we required both issues to have the same assignee.)</p><p>So, to compare both issues’ assignees we can now write the following expression and add it as a workflow condition:</p><pre>user.accountId != issue.parent.assignee.accountId</pre><figure><img alt="Adding a Jira Expression as a Workflow Condition" src="https://cdn-images-1.medium.com/max/622/1*ZZU530aOEt1MoQqkDrs8Hw.png" /><figcaption>Adding a Jira Expression as a Workflow Condition</figcaption></figure><p>And there you have it, simple as that. if you want to use this or any other kind of Jira Expression in your workflows, check out <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows?hosting=cloud&amp;tab=overview">Cloud Workflows</a>!</p><p>Next week we will look at how to build much more complex Jira Expressions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb68923ca538" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jira-expression-of-the-week-separation-of-concerns-fb68923ca538">Jira Expression of the Week — Separation of Concerns</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jira Expression of the Week — Part 2]]></title>
            <link>https://medium.com/jodocus-blog/jira-expression-of-the-week-part-2-c88e1f401059?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/c88e1f401059</guid>
            <category><![CDATA[workflow]]></category>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Thu, 11 Jul 2019 17:49:18 GMT</pubDate>
            <atom:updated>2020-08-07T14:17:53.038Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira Expression of the Week — Filtering Results</h3><p>This week we will look into a Jira Expression which allows to make sure that a “user has entered at least one comment” as a condition (or validator) in a workflow.</p><p>Last week, we came up with an expression to give us the plaintext version of all comments of an issue. It looked like this:</p><pre>issue.comments<br> .map(c =&gt; c.body.plainText)</pre><p>So, there were a few parts to this. The issue itself, these issue’s comments, the map()-function, and finally the plaintext of each comment. We will use these elements and a few more today to build this week’s expression. If you are unsure about all the elements above or haven’t read <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-1-fecdbddf429d">last week’s article</a>, you can get up to speed <a href="https://medium.com/@jodocus/jira-expression-of-the-week-part-1-fecdbddf429d">here</a>.</p><blockquote>You do not need any extra apps to follow along — everything can be done via the Jira Expression <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jira-expressions/#api-rest-api-2-expression-eval-post">REST API</a>. However, the easiest way to work with Jira Expressions is to use our free app, <a href="https://marketplace.atlassian.com/apps/1223058/expression-tester?hosting=cloud&amp;tab=overview&amp;utm_source=medium&amp;utm_medium=article&amp;utm_campaign=et_launch">Expression Tester</a>. You can install the Expression Tester from the <a href="https://marketplace.atlassian.com/apps/1223058/expression-tester?hosting=cloud&amp;tab=overview&amp;utm_source=medium&amp;utm_medium=article&amp;utm_campaign=et_launch">Atlassian Marketplace</a>.</blockquote><p>Now, Jira Cloud by itself does not offer Jira Expressions as workflow conditions or validators. However, there are apps that extend Jira Cloud to allow this feature, for example our own app <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">Cloud Workflows</a>. So, if you want to follow along and go ahead and give it a spin. Of course, you can also use the REST API to test all the expressions discussed in this series.<br> <br>This week, we will create an expression that verifies that the current user has entered a comment. We already know how to select all comments of an issue using an expression that accesses the comments attribute:</p><pre>issue.comments</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9-mRppzF55zvWXiFouCYA.png" /></figure><p>This produces a lengthy list of all the issue’s comments with a lot of extra information, most of which we do not need. Since we are interested in who wrote each comment and using <a href="https://developer.atlassian.com/cloud/jira/platform/jira-expressions-type-reference/">Atlassian’s reference documentation</a>, we find that every comment has an author attribute, which in turn has a displayName attribute. So, let’s use the map()-function to see who wrote the comments:</p><pre>issue.comments<br> .map(c =&gt; c.author.displayName)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XaAptBBpStJVyaN_U-ew0A.png" /></figure><p>So, now we have a list of names, yeah! However, we are only interested in comments written by a specific user. If only there was a way to filter the list… Of course there is: it’s the filter()-function and it works very similar to the map()-function.</p><pre>issue.comments<br> .filter(c =&gt; c.author.displayName == “Oliver Siebenmarck”)<br> .map(c =&gt; c.author.displayName)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vWsRmmXV2t5M5fCegJbdCA.png" /></figure><p>The filter()-function returns a list with only those elements for which a condition returns true. In our example above that is true for those comments whose author’s displayName is “Oliver Siebenmarck”. Which of course works in my case, but hard-coding a name is hardly an ideal solution. Fortunately, Jira Expressions have us covered here: they have a user object in the context. This user object always contains some data on the current user and we can easily use it like this…</p><pre>user.displayName</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X7BAerJairHmLKzBUm_K9A.png" /></figure><p>…and get the displayName of the current user. Using this, we can now build a general filter:</p><pre>issue.comments<br> .filter(c =&gt; c.author.displayName == user.displayName)<br> .map(c =&gt; c.author.displayName)</pre><blockquote>Before we continue, a quick word on GDPR and data privacy. Atlassian takes data privacy quite seriously and has taken steps to ensure that <a href="https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/?_ga=2.37174569.844622782.1562497368-1553409358.1561536968#testing-your-gdpr-changes">the REST APIs of their products respect user data</a>.<br>While the Jira Expressions API has not been affected, as a consequence of these measures, the reliable and future-proof way to work with user identities is to use the accountId attribute rather than displayName. Since we found displayName easier to grasp, we have used it in the examples up to this point, but we will use the accountId in the examples from now on.</blockquote><p>We now have a general filter that returns a list of all comments of the current user has made on a given issue. If this list has at least one entry, we know the user commented on the issue, so this is what we are going to check using the length attribute every list in Jira Expression has.</p><pre>issue.comments<br> .filter(c =&gt; c.author.accountId == user.accountId)<br> .length</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLWjnHSfIETkImNOdi6FSQ.png" /></figure><p>Two comments! That’s definitely more than none, but to use this as a condition, we need our expression to return either true or false. Luckily, we can simply add &gt; 0 and turn the whole expression into a boolean expression (i.e. it returns either true or false):</p><pre>issue.comments<br> .filter(c =&gt; c.author.accountId == user.accountId)<br> .length &gt; 0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4H-lB1rNP27hHnOUmMtT_A.png" /></figure><p>And that’s it — if the current user has commented at least once on the issue, the whole expression will evaluate as true — it will returnfalse otherwise. If you are a user of <a href="https://marketplace.atlassian.com/apps/1220407/cloud-workflows">Cloud Workflows</a> you can now add that expression as a condition or validator to your workflow transitions and never again have a user close an issue without adding a comment first.</p><p>Join us again next week, when we have a look at how to build expressions that work with an issue’s parent issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c88e1f401059" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jira-expression-of-the-week-part-2-c88e1f401059">Jira Expression of the Week — Part 2</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jira Expression of the Week – Part 1]]></title>
            <link>https://medium.com/jodocus-blog/jira-expression-of-the-week-part-1-fecdbddf429d?source=rss-30b16d0b9429------2</link>
            <guid isPermaLink="false">https://medium.com/p/fecdbddf429d</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[atlassian]]></category>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[workflow]]></category>
            <dc:creator><![CDATA[Jodocus]]></dc:creator>
            <pubDate>Thu, 04 Jul 2019 16:20:18 GMT</pubDate>
            <atom:updated>2020-08-07T14:18:31.451Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jira Expression of the Week – Reading the Comments</h3><p>Today, we kick off our blog with a series of Jira Expressions of the week to showcase how versatile and easy to use <a href="https://developer.atlassian.com/cloud/jira/platform/jira-expressions/">Jira Expressions</a> are. Each week, we will look at a different Jira Expression and explain what it does and how it can be used to make your life as a Jira Admin easier.</p><blockquote>You do not need any extra apps to follow along — everything can be done via the Jira Expression <a href="https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jira-expressions/#api-rest-api-2-expression-eval-post">REST API</a>. However, the easiest way to work with Jira Expressions is to use our free app, <a href="https://marketplace.atlassian.com/apps/1223058/expression-tester?hosting=cloud&amp;tab=overview&amp;utm_source=medium&amp;utm_medium=article&amp;utm_campaign=et_launch">Expression Tester</a>. You can install the Expression Tester from the <a href="https://marketplace.atlassian.com/apps/1223058/expression-tester?hosting=cloud&amp;tab=overview&amp;utm_source=medium&amp;utm_medium=article&amp;utm_campaign=et_launch">Atlassian Marketplace</a>.</blockquote><p><strong>But first</strong>: What are Jira Expressions?</p><p>The short answer is: Jira Expressions are a domain-specific language that allows you to select and compare specific data from Jira Cloud in a single, concise expression.</p><p>Let’s break it down a bit more: A Jira Expression is nothing more than a short string that is evaluated within Jira Cloud to give you a result. Mostly, you will encounter Jira Expressions when building custom Conditions and Validators. But Jira Expressions can do quite a bit more: They allow app developers to add UI elements in certain conditions and they can be used in a REST API. Atlassian’s official <a href="https://developer.atlassian.com/cloud/jira/platform/jira-expressions/">documentation</a> includes a few examples and a complete reference. Here at Jodocus, we are big fans of Jira Expressions and rely heavily on them.</p><p>For our first example, let’s assume we want to read all the comments of an issue but nothing else. This can be done like this:</p><pre>issue.comments<br> .map(c =&gt; c.body.plainText)</pre><p>This expression returns the text of all comments for an issue, looking something like this:</p><pre>[“Hello World “,”A small comment made by me”,”some comment”]</pre><p>Pretty neat, isn’t it? Just the data we want, nothing else. So how does it work?</p><p>Whenever a Jira Expression is evaluated, there is some context. Context refers to the data that is available when evaluating the expression. In our example, that is the issue CTP-1, which is available as ‘issue’, which in itself is already a valid Jira Expression, albeit not a very useful one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BrqQToR2ifoST256t68VtA.png" /></figure><p>We want the issue’s comments, which are available as an attribute to the issue. Getting to an attribute is done like this:</p><pre>issue.comments</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JVFeRbL4pAwl7AiUsIZzZQ.png" /></figure><p>Closer, but not quite what we are looking for. We get a list of all the comments, but there still is so much information for every comment. This is where the map()-function comes in. <br>The map()-function allows us to execute a small piece of code for every element of a list and returns a new list of all the results. Since we really just want the comment as plain text, we can get away with a very easy piece of code: we just let it return the attribute we want, which is body.plainText of every comment. Here’s how map() allows us to do that. <br>Whenever there is a list in Jira Expression, we can use map(). We just need to provide map() with a function to execute on every element, which is this part:</p><pre>c =&gt; c.body.plainText</pre><p>In plain language this says: Hey Jira, for every element in my list, let’s call it c, I want you to return the attribute body.plainText. And that’s what Jira does, giving us a nice plain list of comments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDI_uEIJ_AY9Qg_FRN4gRA.png" /></figure><p>And there you have it – a nice, concise Jira Expression that you could use in a REST call to get all comments to an issue. Next week, we will use this expression as a basis for a “User has entered at least one comment”-condition to be used in a workflow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fecdbddf429d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/jodocus-blog/jira-expression-of-the-week-part-1-fecdbddf429d">Jira Expression of the Week – Part 1</a> was originally published in <a href="https://medium.com/jodocus-blog">Jodocus Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>