Hi,
I am trying to use lister to clone a ticket when the original ticket is resolved and update the ticket cloned ticket with CF x to CF Y
My current settings are:
condition:
cfValues['Request Type']?.value == 'X'
Additional issue actions:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Request Type")
issue.setCustomFieldValue(cf,'Y')
issue.setAssignee(null)
I also tried:
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Request Type'}
issue.setCustomFieldValue(cf,'Y')
issue.setAssignee(null)
so the ticket is cloned and the relevant fields are copied but the request type is X and not being modified to Y. It is not even showing up on the cloned ticket so I believe the value is being 'null'...
any idea what I am doing wrong?
thanks,
Hi Jason,
When creating a behaviour, the behaviour should be attached to the field that you want to track or check values from. In your case, you should put this behaviour on the Cascading Select custom field.
Your script isn't far off, but there's some things you need to change. First, Cascading Select Lists return a list of values whenever you call getValue() on the field. Example: ['Parent Option', 'Child Option']
So if you want to check the first dropdown, you'll need to access the first value of the list.
def cascadingField = getFieldById(getFieldChanged())
def cascadingValues = cascadingField.getValue()
def PaypalPayee = getFieldById("customfield_11906")
PaypalPayee.setHidden(true)
if (cascadingValues[0] == "Paypal") {
PaypalPayee.setHidden(false)
}
Jason,
The static type checker is not always accurate. The behaviour should work regardless of the error. Try to use it. It worked for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joshua,
Unfortunately, it's not working.
When I open the create issue screen, "Paypal Payee Name" is still shown even if payment type has "None" selected.
I would like this to show only if "Paypal" is selected.
Any other ways I could achieve this?
Thanks,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jason,
It looks like you changed the script that I gave you? You have this in your screenshot:
if (PaymentType[0] == "Paypal")
when it should be this
if (cascadingValues[0] == "Paypal")
That's probably why you're getting that static type checking error, because you're trying to access an index of the object instead of the object's values.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to hear Jason! :)
If you wouldn't mind, please accept my answer as the accepted answer so that others in the community can see the answer more easily.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I'm dealing with same issue.
Code is completely the same.. What am I doing wrong? Can someone please answer. I would relay appreciate it. Can this be done in different way?
I new to scriptRunner and groovy.
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.