HI - I am trying to setup a ticket where original date shows on the ticket create(of the subtask ticket) screen only if the sub-task issue type and the value entered in another custom field are as specified. I am struggling with the sub-task ticket. Here is my code.
def IssueType = getFieldByName("Campaign")
def subIssueType = getFieldByName("Data Enhancement")
def productField = getFieldByName("Product")
def productFieldValue = productField.getValue()
def originalDueDateField = getFieldByName("Original Due Date")
switch (productFieldValue){
case "Match Analysis":
originalDueDateField.setHidden(false)
break
case "Data Append":
originalDueDateField.setHidden(true)
break
case "Data Feed":
originalDueDateField.setHidden(true)
break
case "Data License":
originalDueDateField.setHidden(true)
break
case "Exposure File":
originalDueDateField.setHidden(true)
break
case "Score Append":
originalDueDateField.setHidden(true)
}
Thanks for all the answers! I am still getting an error on:
issue.getIssueTypeObject().isSubtask() -- error = cannot find matching method com.onresolve.jira.goroovy.user.FormField#getIssueTypeObject(). Please check if the declared type is right and if the method exists.
if(!issue.getIssueTypeObject().isSubTask())
return -- error = cannot find matching method com.onresolve.jira.goroovy.user.FormField#getIssueTypeObject(). Please check if the declared type is right and if the method exists.
Here is the posted code:
import com.atlassian.jira.issue.Issue
def IssueType = getFieldByName("Campaign")
def issue = getFieldByName("Data Enhancement")
def productField = getFieldByName("Product")
def productFieldValue = productField.getValue()
if(!issue.get("issueType").isSubTask())
return
def originalDueDateField = getFieldByName("Original Due Date")
switch (productFieldValue){
case "Match Analysis":
originalDueDateField.setHidden(false)
break
case "Data Append":
originalDueDateField.setHidden(true)
break
case "Data Feed":
originalDueDateField.setHidden(true)
break
case "Data License":
originalDueDateField.setHidden(true)
break
case "Exposure File":
originalDueDateField.setHidden(true)
break
case "Score Append":
originalDueDateField.setHidden(true)
}
This code works witout error on my instance
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def issue = getFieldByName("Data Enhancement")
def productField = getFieldByName("Product")
def productFieldValue = productField.getValue()
//Issue issue = ComponentAccessor.getIssueManager().getIssueObject("")
if(!issue.getIssueTypeObject().isSubTask())
return
def originalDueDateField = getFieldByName("Original Due Date")
switch (productFieldValue){
case "Match Analysis":
originalDueDateField.setHidden(false)
break
case "Data Append":
originalDueDateField.setHidden(true)
break
case "Data Feed":
originalDueDateField.setHidden(true)
break
case "Data License":
originalDueDateField.setHidden(true)
break
case "Exposure File":
originalDueDateField.setHidden(true)
break
case "Score Append":
originalDueDateField.setHidden(true)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
issue.getIssueTyoeObject() is supposed to run for an issue object, not a field one.
def issue = getFieldByName("Data Enhancement")
This doesn't make any sense.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Agree, it is not a good name for variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you post the whole script?
I don't see any part where you check the subtask or parent relation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Ashlee, here is code to check if issue is subtask or not
issue.getIssueTypeObject().isSubTask()
Issue type is build-in field, not a custom one. Since special method to get its value is used.
Best regards,
Vasiliy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here you are
import com.atlassian.jira.issue.Issue
//here is code to check if issue is subtask or not
if(!issue.getIssueTypeObject().isSubTask())
return
def originalDueDateField = getFieldByName("Original Due Date")
switch (getFieldByName("Product").getValue()){
case "Match Analysis":
originalDueDateField.setHidden(false)
break
case "Data Append":
originalDueDateField.setHidden(true)
break
case "Data Feed":
originalDueDateField.setHidden(true)
break
case "Data License":
originalDueDateField.setHidden(true)
break
case "Exposure File":
originalDueDateField.setHidden(true)
break
case "Score Append":
originalDueDateField.setHidden(true)
}
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.