Hello Community,
Using seemingly simple setDescription in Scriptrunner updates scriptrunner log but not the actual issue description
Any help greatly appreciated.
Thank you
Hi @Amed Moreno ,
Did you try using Automation for JIRA? It's way lighter experience to automate your workflow and its native on JIRA Cloud and DC environment. You can learn more bout Automation for JIRA on below webinar:
- https://events.atlassian.com/unleash/v/s-1268659
About your question when you invoke the setSummary function it changes the Issue Object but it does not write to the database the updated summary version.
In order to update the summary you might need to use the IssueService which provides a method to update an issue (https://docs.atlassian.com/software/jira/docs/api/9.4.0/com/atlassian/jira/bc/issue/IssueService.html#update-com.atlassian.jira.user.ApplicationUser-com.atlassian.jira.bc.issue.IssueService.UpdateValidationResult-).
See examples:
I didn't test but the following code might work,
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.IssueInputParametersImpl
// the issue key to update
final String issueKey = "PLAYG-7"
// change to 'true' if you want to send an email if the update is successful
final boolean sendMail = false
def issueService = ComponentAccessor.issueService
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = ComponentAccessor.issueManager.getIssueByCurrentKey(issueKey)
assert issue : "Could not find issue with key $issueKey"
def issueInputParameters = new IssueInputParametersImpl()
issueInputParameters.setDescription("New Description")
def updateValidationResult = issueService.validateUpdate(loggedInUser, issue.id, issueInputParameters)
assert updateValidationResult.valid : updateValidationResult.errorCollection
def issueUpdateResult = issueService.update(loggedInUser, updateValidationResult, EventDispatchOption.ISSUE_UPDATED, sendMail)
assert issueUpdateResult.valid : issueUpdateResult.errorCollection
Hi Italo,
Thank you for the response and help. Yes, I know of Automation for Jira and use often. I am trying to learn Scriptrunner so posting to gain knowledge on the subject.
I still have a lot to learn. That script is very complex for just setting a description and can see why you suggested Automation for Jira.
Thanks again and Kind Regards,
Amed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
def issue = Issues.getByKey('ABC-1')
issue.update {
setSummary('an updated summary')
setDescription('hello *world*')
}
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.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.