The value you get from issue.get("customfield_12406") depends on the custom field type. If it's a Select list field, it will be an Option object, on which you can get the String value using .getValue().

Note that the result will then be a String, so you should compare it with a String constant using the .equals() method.

Thanks so much, I really appreciate the help, but I've used exactly the code you provided (coincidentally it was a "yes" option in the select list I was testing for) and still nothing is happenning (regardless of whether the custom field value is "yes" or "no").

If I just leave the clause issue.get("customfield_12406") != null then the field gets set as expected.

I can't get access to the logs until our Ops guys are back in on tuesday (we're about to shut down for Easter), so will try that then. In the meantime, any more thoughts appreciated.

thanks again,

Mark.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

Thanks both for your quick and helpful responses. But unfortauntely I still can't get the condition to work. I've checked the custom field id (and the value that corresponds to the "yes" pick list item) and tried updating the condition expression to :

issue.get("customfield_12406") == "11301"

or

issue.get("customfield_12406") == 11301

but it still doesn't work.

I've also tried

issue.cfValues["customfield_12406"] == "11301"

or

issue.cfValues["customfield_12406"] == 11301

Any more ideas? I've also tried doing a re-index before this step, but that didn't make a difference.

thanks in anticipation.Mark.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

It seems that the problem was down to the "Copy only if not set" checkbox - I had ticked this, as I didn'ty want values to be overwritten, but it seems as if it was conflicting in some way with the conditional logic below. I unticked it, and changed the condition to the following, and everything now works as expected.

I'm glad it worked. But I'm surprised by your explanation, as there is no relationship (in the code) between those two options. I suspect the value would not have been set even without the condition. Probably because the destination field is never really empty (== null).

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

You can add
log.error(issue.get("customfield_12406"));
log.error(issue.get("customfield_12406").getValue());
and then look inside atlassian-jira.log for "innovalog". You should find log entries or type "ERROR" with the value of these expressions. This will tell you if your test is correct.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

Dear @David [Innovalog] ,
Now after putting the below,
log.error("nadim is here");
issue.get("customfield_10611").equalsIgnoreCase("Billing Adjustment");
am not getting any error in the logs.
I put the post function as final post function after the creation and reindexing and fire created issue.
Thanks

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

What am trying to do is, based on a value of a custom field A,
if it has the value of A, it will create a linked issue with the status open.
if it has the value of B, it will create a linked issue with the status in progress.
so i put this post function in the level of the linked issue to transit directly to the in progress status when this customfield has the value of B.
It is now working, please advise.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.

You are getting a Null Pointer Exception in your Groovy script. issue.get("customfield_12406") must be returning NULL.
Also, what you are trying to do won't work, because you need to use the "Transition Issue" post-function on the newly created linked issue, not the Transition Linked Issue post-function, which would need to be used on the original ("parent") issue.
And the Transition Issue function doesn't work during the Create transition. See https://innovalog.atlassian.net/browse/JMWE-271.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.