Hi,
i would like to get the properties of issue with scriptrunner?
do you have an idea?
thanks
Assuming you mean non-field properties such as described here ...
Try to explore the IssuePropertyService
import com.atlassian.jira.bc.issue.properties.IssuePropertyServicedef issuePropertyService = ComponentAccessor.getComponentOfType(IssuePropertyService.class)issuePropertyService.getPropertiesKeys(null, issue.id).each{ log.info it.keys()}
What do you mean by properties? Field values?
The majority of your interactions with issues using the Java API will occur with the Issue and IssueManager classes (and of course MutableIssue).
https://docs.atlassian.com/software/jira/docs/api/7.11.0/com/atlassian/jira/issue/Issue.html?_ga=2.69582098.367400705.1556550288-1439335163.1544544516https://docs.atlassian.com/software/jira/docs/api/7.11.0/com/atlassian/jira/issue/IssueManager.html?_ga=2.69582098.367400705.1556550288-1439335163.1544544516https://docs.atlassian.com/software/jira/docs/api/7.11.0/com/atlassian/jira/issue/MutableIssue.html?_ga=2.69582098.367400705.1556550288-1439335163.1544544516
So a simple Scriptrunner script that pulls a few issue properties might look like this (some things expanded for clarity that would otherwise be simplified in a real script):
import org.apache.log4j.Loggerimport org.apache.log4j.Levelimport com.atlassian.jira.component.ComponentAccessor// Set logging level so we can see debug informationdef log = Logger.getLogger("com.example.ListIssueProperties");log.setLevel(Level.DEBUG);// This is how we log information in Scriptrunner:// log.debug("This will appear in Scriptrunner logs");// Modify this to be the issue key you want to examine:def issueKey = "PROJECTKEY-1";// Get an instance of the Issue Managerdef issueManager = ComponentAccessor.getIssueManager();// Get the issue you're interested in by issue key:def issueObject = issueManager.getIssueObject(issueKey);// We can now access the issue properties, as below:def issueObjectPriority = issueObject.getPriority();def issueObjectStatus = issueObject.getStatus();// Output the issue status name and priority name to debug logging:log.debug("Issue status: ${issueObject.getStatus().name}");log.debug("Issue priority: ${issueObject.getPriority().name}");return null;
great! that exactly what i want! thanks a lot Peter-Dave
properties of issue , see answer of Peter-Dave
thanks for your answer, but that's not what I'm looking for
It looks like you're new here. Sign in or register to get started.