All samples below have to be entered into the text field on tab "Rules". These rules will be executed automatically for all traffic light fields.
if (issue.status.name == "To Do" && issue.trafficLight("Criticality") == null) issue.trafficLight("Criticality", "(,yellow,) yellow"); |
The status name has to be adjusted according to your workflow (creating an issue would result into this target status).
if (new Date(issue.duedate).getTime() < (new Date()).getTime() - 864000) issue.trafficLight("Criticality", "(,yellow,) yellow"); |
A day has got 864000 milliseconds: yesterday is yet - 1 day = new Date().getTime() - 864000. For comparison, use the datetime in milliseconds.
// Having multiple subtasks, the last update will overwrite all others: var myCriticality = issue.trafficLight("Criticality"); |
Using this scenario, the a subtask modification will update its parent: having multiple subtasks, the last update will overwrite all others.
What you can also do: check the parent's traffic-light field's content and update this in case of a higher severity instead of inequality like in the sample above, only.
// Having multiple linked target issues, the last update will overwrite prior settings of the linked source issue: var myCriticality = issue.trafficLight("Criticality"); |
Depending on the link direction, you can use issue.inward() or alternatively issue.outward() for the opposite link direction. The first parameter is the issue link type's direction name. Here: "relates to" is used, which is the same for both link directions whereas inward:"is blocked by" and outward:"blocks" in case of the issue link type "Blocks".
var field1_name = "Technical Knowledge"; var field2_name = "Developing"; if (field1_value < field2_value) issue.trafficLight("Usability", "(,,red) red"); |
Having configured an option field named "project size" with options "small", "medium" and "large" and a new date-picker custom field "current due date" and use of Jira's build-in field "due date", you can retrieve the content of that 3 fields and compare them to determine automatic setting of traffic-light field named "Indicator":
var field1_name = "Due Date"; var field2_name = "Current Due Date"; var field3_name = "Project Size"; if (projectSize == "Small") { |
If you want to automatically synchronize the content of a Traffic-Light field with one of Jira's custom fields, you can easily do that:
Having done this, you have to enter the related rule to synchronize:
Finally, you have to configure your SCRUM or KANBAN board to display the new custom field on your issues' card:
The only disadvantage of Jira Cloud is, that based on different technologies in the background in opposite to the Jira Server Edition, the traffic-light content cannot be rendered as graphic sign - just as text on the card by its label. But that's nothing, any third-party vendor can influence!