Hi
I am needing to set a label on an issue in my jelly script, I know how to get the labels, but I cant find anything in the javadocs that allows me to create a new label or get an existing label to set on an issue:
<core:invoke on="${issueKey}" method="getLabels" var="labels" />
<!-- Get or create a label -->
<core:invoke on="${labels}" method="add" var="flag">
<core:arg type="com.atlassian.jira.issue.label.Label" value="???" />
</core:invoke>
<core:invoke on="${issueKey}" method="setLabels">
<core:arg type="java.util.Collection" value="${labels}" />
</core:invoke>
Any help would be very much appreciated, thank you!
You can use the LabelManager, like this:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:core="jelly:core" xmlns:log="jelly:log"> <jira:CreateProject key="XYZ" name="XYZ Project" lead="admin"> <jira:CreateIssue summary="Rocket thrusters not firing" reporter="admin" assignee="admin" issueIdVar="issueId" /> </jira:CreateProject> <core:invokeStatic className="java.lang.Class" method="forName" var="clazz"> <core:arg type="java.lang.String" value="com.atlassian.jira.issue.label.LabelManager" /> </core:invokeStatic> <core:invokeStatic className="com.atlassian.jira.component.ComponentAccessor" method="getComponent" var="labelManager"> <core:arg type="java.lang.Class" value="${clazz}" /> </core:invokeStatic> <core:invoke on="${labelManager}" method="addLabel"> <core:arg type="com.atlassian.crowd.embedded.api.User" value="${jelly.user}" /> <core:arg type="java.lang.Long" value="${issueId}" /> <core:arg type="java.lang.String" value="oops" /> <core:arg type="boolean" value="false" /> </core:invoke> </JiraJelly>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this possible without updating the updatedDate, too? e.g. the comment manager has a flag "tweakIssueUpdateDate".
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.