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

Scripted field not correct

Deleted user Apr 26, 2017

I made a field autoAssignee; just regular text field which populates a value based on some values. This is working fine, except when in status "New". The field takes the value for the next status, which screws up my proces. 

When a ticket is in status new, I always get the value of status "Assess 1st Line".

e.g.: status = new

productC

customerA

assignee should be productC.support

but it shows consultant.customerA

 

anyone has an idea?

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.issue.Issue
import com.atlassian.crowd.embedded.api.User
 
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def userUtil = ComponentAccessor.getUserUtil()
def productCF = customFieldManager.getCustomFieldObject("customfield_13901")
def customerCF = customFieldManager.getCustomFieldObject("customfield_13102")
def product = issue.getCustomFieldValue(productCF)
def customer= issue.getCustomFieldValue(customerCF)
def status = issue.getStatus().getSimpleStatus().getName()
def project = issue.getProjectObject().getKey()
def type = issue.getIssueType().getName()

def assignee =""
	if(product =="ProductA"){
        assignee ="ProductD.support"
   	} else if(product =="ProductB"){
        assignee ="ProductB.support"
 	} else if(project == "BX" && product == "ProductB" && (status == "New" || "Assess 1st Line" || "Assess 2nd Line")){
        assignee = "ProductB.support"        
    } else if(project == "AX" && product =="ProductC"){
        assignee ="ProductC.support"
    } else if(project == "BX" && product =="ProductC" && customer == "CustomerA" && (status == "Assess 1st Line" || "Assess 2nd Line")){
        assignee ="ProductC.CustomerA"
    } else if(project == "BX" && product =="ProductC" && customer == "CustomerA" && (status == "New")){
        assignee ="ProductC.support"
    } else if(project == "BX" && product =="ProductC" && customer != "CustomerA"){
        assignee ="ProductC.support"
    } else if(project == "AX" && product == "ProductD"){
        assignee = "ProductD.support"        
    } else if(project == "BX" && product == ("ProductD" || "ProductD Client Connect") && (status != "Assess 1st Line")){
        assignee = "ProductD.support"
    } else if(project == "AX" && product == "ProductD Client Connect"){
        assignee ="ProductD.support"   
	} else if(project == "BX" && type == "Bug" && (product == "ProductD" || "ProductD Client Connect") && status == "Assess 2nd Line"){
        assignee = "rd.ProductD"
    } else if(project == "BX" && type == "Request for Enhancement" && (product == "ProductD" || "ProductD Client Connect") && (status == "Assess 2nd Line")){        
        assignee = "ProductD Changemanagement"     
    } else if(project == "BX" && (product == "ProductD" || "ProductD Client Connect") && (status == "Assess 1st Line" || "Assess 3rd Line") && customer == "CustomerC"){
        assignee = "consultant.CustomerC"
    } else if(project == "BX" && (product == "ProductD" || "ProductD Client Connect") && (status == "Assess 1st Line" || "Assess 3rd Line") && customer == "CustomerA"){
        assignee = "consultant.CustomerA"
    } else if(project == "BX" && (product == "ProductD" || "ProductD Client Connect") && (status == "Assess 1st Line" || "Assess 3rd Line") && customer == "CustomerB"){
        assignee = "consultant.CustomerB"
    } else if(product =="Other"){
        assignee ="ProductD.support"
    }  
   
return assignee;

2 answers

0 votes

If you edit the issue (not transition, just edit), does the field change to the desired value?

Deleted user Apr 26, 2017

No, it doesn't. 

If I change one of the values, like the product, the fields changes, but to consultant.productX

 

0 votes
Deleted user May 02, 2017

I've also tried it with status ID and the only status it doesn't work with, is the status "new".

 

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...

72 views 0 3
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