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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Validate the custom field value on behaviour on the basis of customer details Edited

When customer raising the ticket in XYZ project then on the basis of customer details, the custom field value will be populate.

Let say, one custom field is created[XYZ] that is on single list, in that list 10 value is added i.e. A,B,C,D,E,F.
We are using element connect plugin for getting the customer details like project name,project manager etc.

At the time of creating/raising the ticket, if the project name of the customer is X1 then A,B value will be populate on XYZ custom field else if project name of the Customer is X2 then D,E value will be populate on XYZ custom field else the project name of the customer is X3 then C,F value will be populate.

I am unable to get the customer details like Project Name, Project Manager at the time of raising the ticket that is on pre-condition.
Also i am unable to set the condition on behaviour.

Please suggest us.

1 answer

Below behaviour should help you.


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.onresolve.jira.groovy.user.FormField

def optionsManager = ComponentAccessor.optionsManager
def customFieldManager = ComponentAccessor.customFieldManager
def CF = getFieldByName("Custom Field Name")
// Getting list of all option for customer field
def customField = customFieldManager.getCustomFieldObjectsByName("Custom Field Name")[0]
def fieldConfig = customField.getRelevantConfig(getIssueContext())
List options = optionsManager.getOptions(fieldConfig)

// Getting Value of Project Custom Field , attach the script to this field in bhaviour
FormField proj = getFieldById(getFieldChanged())
// Possible Values X1 | X2 | X3
def projVal = proj.getValue().toString()

def Mapping = [ "X1" : ['A','B'],
                            "X2" : ['D','E'],
                            "X3" : ['C','F']

if ( Mapping.containsKey(projVal)) {

   List optionsList = Mapping[projVal]
   def optionsToSet = options.findAll { it.value in optionsList }


@Subrat Mishra :

Is there any plugins in which customer can view their own details like Project Name, Project Manager, Customer Contact no etc at the time of creating the ticket.  The value(Means Project Details) will be populate from the External DB.

In case you remember the plugins name then let me know. So that i can mapped.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

216 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you