Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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.

Example:
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 }
   CF.setFieldOptions(optionsToSet)

}

@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
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New cloud apps roundup - June 2021

Since our last roundup in April, Atlassian's Marketplace Partners have added over 100 new cloud apps to the Atlassian Marketplace to help your teams work more efficiently. Let’s take a quick look a...

466 views 5 12
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