Hi All,
I have two custom fields called "cf1 and cf2" . The ask is make cf2 read only and it should update depending on cf1 single select options. Please help me to address this situation. I'm a new bee to the scripting part.
Hi @kk4065896
With Behaviours in Scriptrunner!!
Example here
https://community.atlassian.com/t5/Jira-questions/Sync-between-two-fields-and-make-one-of-the-field-read-only/qaq-p/1941087
Another example is here
Define the Behaviour for fruits field and get the field ID of the field you need to make it as read-only, change the relevant options below
def fruits = getFieldById(getFieldChanged()).getValue().toString()if (fruits == "Apple") {getFieldById("customfield_10402").setFormValue("20 Rs");}else if (fruits == "Mango") {getFieldById("customfield_10402").setFormValue("10 Rs");}else {getFieldById("customfield_10402").setFormValue("5 Rs");}
Let me know if you have any queries
Thanks,Pramodh
@Pramodh M
Thank you for sharing your answer and I tried to use the code but it is not working for me.
Here is the script what I used:
import com.atlassian.jira.issue.IssueFieldConstantsimport com.onresolve.jira.groovy.user.FieldBehavioursimport groovy.transform.BaseScript@BaseScript FieldBehaviours fieldBehavioursdef ManagerRole = getFieldById("customfield_10214")def DeploymentState = getFieldById("customfield_11111")if (ManagerRole == "None") {getFieldById("customfield_11111").setFormValue("None");}else if (ManagerRole == "HR") {getFieldById("customfield_11111").setFormValue("HR");}else if (ManagerRole == "A&Z") {getFieldById("customfield_11111").setFormValue("A&Z");}else if (ManagerRole == "GA") {getFieldById("customfield_11111").setFormValue("GA");}else if (ManagerRole == "T") {getFieldById("customfield_11111").setFormValue("T");}else if (ManagerRole == "Dev") {getFieldById("customfield_11111").setFormValue("Dev");}else if (ManagerRole == "Go") {getFieldById("customfield_11111").setFormValue("Go");}else if (ManagerRole == "DI") {getFieldById("customfield_11111").setFormValue("Unknown");}else if (ManagerRole == "New") {getFieldById("customfield_11111").setFormValue("New");}else if (ManagerRole == "Unknown") {getFieldById("customfield_11111").setFormValue("Unknown");}else if (ManagerRole == "CEO") {getFieldById("customfield_11111").setFormValue("CEO");
It looks like you're new here. Sign in or register to get started.