Scriptrunner Post-Function: issue returns as null when using "Clone an issue, and link".

Diana
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 24, 2024

When project TEST, any issue type, transitions to "In Progress" and custom field "Dropdown Field" = Option 1, there is a post function to "Clone an Issue, and Link".

Under "Additional actions", setting a custom field on the new issue returns as 'null' and does not set the custom field value. Yet, it works when using setting issue summary.

test1.PNGtest2.PNGtest3.PNG

When I try to use issue.setCustomFieldValue, the logs return property id on null object. When I ONLY use issue.summary, the issue properly gets created and linked. When I try to add a log.warn, it returns the issue as null.

I've also tried "doAfterCreate" from this page and got "no signature of method" error.

Any reason why "issue.summary = 'blah'" works yet "issue.setCustomFieldValue(cf, 'value')" will not?

2 answers

1 accepted

0 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2024

Hi @Diana Gorv

I have tried to replicate this issue in my environment, but I am not encountering this issue.

Below are the sample codes that I have tested with:-

1. For the conditions:-

issue.getCustomFieldValue('Sample List').toString() == 'Option1'

2. Additional issue actions

issue.set { 
setSummary('Testing 123')
setCustomFieldValue('Sample Text', 'Testing value')
}
Please note that the sample codes above are not 100% exact to your environment. Hence, you must make the required modifications.
Below is a screenshot of the Post-Function configuration:-
configuration.png
If you observe the sample above, I am using ScriptRunner's HAPI code format on the Condition as well as the Additional issue actions code.
In this example, I have set the Post-Function to the In Progress state and configured the cloned issue to be linked as is caused by link.
I am also including a couple of test screenshots for your reference:-
1. On the create screen, I have added some values for the Description, Summary, Sample Checkbox and Sample List
image1.png
2. Below is a screenshot of the issue that has been created
image2.png
3. Once the issue transitions to In Progress, as expected, the Cloned Issue is created with an updated Summary
image3.png
4. Below is a detailed view of the Cloned issue.
image4.png
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram

 

0 votes
Dave Rosenlund _Trundl_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 24, 2024

Hi, @Diana Gorv  👋

 

I moved your question to App Central, where questions about Atlassian Marketplace products, like Scriptrunner should be posted. Also, I added an additional tag to hopefully draw the right eyeballs to your post.

That said, I suggest you contact the Scriptrunner support team directly for a faster response time and resolution.

Best of luck,

-dave

Dave Rosenlund _Trundl_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 24, 2024

P.S.  If you do, it would be great if you'd come back and share the solution here so others can benefit in the future.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events