Hi
I have one query, i have 2 dropdown field. Client and ClientCode.
In Client field if someone select USA then Clientcode will automatically set to NAMR.
If in client field someone select UK then Clientcode will automatically set to EMEA.
Please suggest how can i do this, i have script runner plugin. Both are dropdown field, do i need to create one scripted field for this ? Please suggest
@Stephen_Wright @Nic_Brough__Adaptavist_ @Kristian Walker (Adaptavist) @Adrian_Stephen @Derek_Fields @Ravi_Sagar__Adaptavist_ @Martin Bayer [MoroSystems, s.r.o.]
Thanks
Hello,
the need of scripted field depends on usability of the field. If you want to leave ClientCode as text field which can user eventually change to his own value, you need Behaviours and classic text custom field. If you need field to be non editable and value always depends on Client field, then scripted field is probably good choice.
Hi @František Špaček _MoroSystems_ can you please help me with the script, i am new to JIRA and script runner.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And which of these two options are needed? Do you need editable field or does the field depends on other field all the time?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vikrant,
the bets option would be go for scripted field then.
In ScriptRunner administration go to Fields and create new field here (it will automatically create new on in Jira configuration too). Put there a name you want, as a template select Text (multiline).
In script, try something like this:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
final def CLIENT_CF = "customfield_11201"
CustomFieldManager customFieldManager = ComponentAccessor.getOSGiComponentInstanceOfType(CustomFieldManager.class)
CustomField clientCF = customFieldManager.getCustomFieldObject(CLIENT_CF)
def client = issue.getCustomFieldValue(clientCF)
def returnVal = ""
switch (client){
case 'UK': returnVal = "EMEA"; break;
case 'USA': returnVal = "NAMR"; break;
}
return returnVal
You only have to change id of CF at the script start, you can also easily add another options in switch statement if needed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.