I wrote a script for a radio button custom field to change the color when an option is chosen. I previewed an issue, and it returned the value, but it is not changing the color on the view screen.
Hi @Anele Mpungose
Whee did you wrote that script? can you share your code to review it?
Regards,
Seba
the script is on Scripted fields
I think you need to use Scriptrunner fragments for this.
https://docs.adaptavist.com/sr4js/latest/features/fragments
Hi @Marc -Devoteam- I went through the documentation and attempted to use Fagments to solve this issue but I am lost. Do you have an example that I can maybe use?
Hi! Below script that I wrote few years ago for similar thing. It worked. Maybe this will help you to solve this.
import com.atlassian.jira.component.ComponentAccessordef issueManager = ComponentAccessor.getIssueManager()def customFieldManager = ComponentAccessor.getCustomFieldManager()def cField = customFieldManager.getCustomFieldObject("customfield_11702")def cFieldValue = issue.getCustomFieldValue(cField)if(cFieldValue == 'R') {return "<div style='color:red;background-color:red;width:20px;border-radius:50%;'>" + cFieldValue + "</div>"}if(cFieldValue == 'G') {return "<div style='color:green;background-color:green;width:20px;border-radius:50%;'>" + cFieldValue + "</div>"}if(cFieldValue == 'Y') {return "<div style='color:yellow;background-color:yellow;width:20px;border-radius:50%;'>" + cFieldValue + "</div>"}
I Came out right. My configurations on the screens were incorrect
It looks like you're new here. Sign in or register to get started.