Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

workflow post function issue

Sasha Pilote May 5, 2023

Hi All,


I have created a scripted post function in my workflow. This function is to color issues based on the value of a custom scripted field called Rating. There are no errors in the script or failures, but i am not seeing the post function do it's thing. here is the script:



import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue

// Set the name of the Rating field
def ratingFieldName = "Rating"

// Set the colors for each range
def redColor = "#FF0000"
def orangeColor = "#FFA500"
def yellowColor = "#FFFF00"
def noColor = "null"

// Get the custom field for the Rating field
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def ratingField = customFieldManager.getCustomFieldObjectByName(ratingFieldName)

// Get the Rating value for the current issue
def ratingValue = issue.getCustomFieldValue(ratingField) as Integer

// Set the color based on the Rating value
if (ratingValue >= 13 && ratingValue <= 16) {
["style": "background-color: $redColor"]
} else if (ratingValue >= 9 && ratingValue <= 12) {
["style": "background-color: $orangeColor"]
} else if (ratingValue >= 4 && ratingValue <= 8) {
["style": "background-color: $yellowColor"]
} else {
["style": "background-color: $noColor"]


i have selected the workflow as the transition view. 


Any additional steps im missing?




1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 8, 2023

Hi @Sasha Pilote

After going through your code, I have a question; i.e. in your if/else condition, I noticed that you are passing the colour into a Map, i.e. ["style": "background-color: <The Color>"].

But where is this map being passed to?

It would seem that the map's value is being set, but it is not being passed to anything else, resulting in no change taking place once the Post-Function is triggered.

Is there additional section in your code that is missing or not added to your description?

I am looking forward to your feedback.

Thank you and Kind regards,


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events