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

Multiple nested if/else statements script failing halfway down Edited

I am trying to get the script below to work - I have tried adding it to each field in behaviours as well as on one field. The issue appears once I add the additional if statement. I have also tried this with an && statement which also breaks.

 

Thanks so much for your help!

 

import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.fields.config.FieldConfigImpl

import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def allowedOptions = null
def fieldArcOptions = null
def fieldPlatformType = getFieldByName("Platform Type")
def valuePlatformType = fieldPlatformType.getValue().toString()
def fieldProductType = getFieldByName("Product Type (DI)")
def valueProductType = fieldProductType.getValue().toString()
def fieldClientType = getFieldByName("Client Type")
def valueClientType = fieldClientType.getValue().toString()
def fieldIntegration = getFieldByName("Integration")
def valueIntegration = fieldIntegration.getValue().toString()
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customFieldIntegration = customFieldManager.getCustomFieldObject(fieldIntegration.getFieldId())
def configIntegration = customFieldIntegration.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(configIntegration)
def issueManager = ComponentAccessor.getIssueManager()

if ((valuePlatformType.toString() == "[Bai]"))
if ((valueProductType.toString() == "Consult") || (valueProductType.toString() == "Standard") || (valueProductType.toString() == "Complex"))
if (valueClientType.toString() == "Provider") {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["PPI", "Online", "Offline", "Dest", "Other"]});
}
else if ((valuePlatformType.toString() == "Bai"))
if ((valueProductType.toString() == "Consult") || (valueProductType.toString() == "Complex"))
if (valueClientType.toString() == "Buyer") {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["Jrn", "S", "BPI", "Other"]});
}
else if ((valuePlatformType.toString() == "Bai"))
if ((valueProductType.toString() == "Ntar"))
if ((valueClientType.toString() == "Provider")) {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["Offline", "Dest"]});
}
else if ((valuePlatformType.toString() == "Dgix") || (valuePlatformType.toString() == "Crosswise"))
if (valueProductType.toString() == "Standard")
if ((valueClientType.toString() == "Provider") || (valueClientType.toString() == "Buyer")) {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["Registration", "Batch"]});
}
else if ((valuePlatformType.toString() == "Ais"))
if (valueProductType.toString() == "Standard")
if (valueClientType.toString() == "Provider") {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["User Sync"]});
}
else if ((valuePlatformType.toString() == "Ais"))
if (valueProductType.toString() == "Standard")
if (valueClientType.toString() == "Buyer") {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["Fose", "Roa"]});
}
else if ((valuePlatformType.toString() == "Eua") || (valuePlatformType.toString() == "Responsys"))
if (valuePlatformType.toString() == "Standard")
if ((valueClientType.toString() == "Buyer") || (valueClientType.toString() == "Provider")) {
allowedOptions = fieldIntegration.setFieldOptions(options.findAll {
it.value in ["Gool", "Private"]});
}

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

101 views 0 6
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