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.ComponentAccessorimport com.atlassian.jira.event.type.EventDispatchOptionimport com.atlassian.jira.issue.IssueInputParametersImpl// the issue key to updatefinal String issueKey = "PLAYG-7"// change to 'true' if you want to send an email if the update is successfulfinal boolean sendMail = falsedef issueService = ComponentAccessor.issueServicedef loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUserdef 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.errorCollectiondef issueUpdateResult = issueService.update(loggedInUser, updateValidationResult, EventDispatchOption.ISSUE_UPDATED, sendMail)assert issueUpdateResult.valid : issueUpdateResult.errorCollection
@Italo Lobato Qualisoni
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
def issue = Issues.getByKey('ABC-1')issue.update { setSummary('an updated summary') setDescription('hello *world*')}
@Italo _Modus Create_
Wow! Awesome Italo! I will be checking this out.
Thanks again!
It looks like you're new here. Sign in or register to get started.