Using a Workflow to control edit of an issue by changing Workflow XML
You can use a workflow "transition" to allow certain users to only edit certain fields of an issue without transitioning to another step of the workflow. This page outlines how to achieve this using direct Workflow XML manipulation. If you are not comfortable with directly editing Workflow XML please see How can I control the editing of issue fields via workflow?.
First note that JIRA's workflow editor (as of Jira 3.4.2) uses the term "transition" where as the OSWorkflow documentation refers to the same element as an "action".
Since, this article primarily deals directly with the XML of the workflow instead of the workflow editor, the term "action" will be used.
As mentioned above, this article assumes knowledge of how to write an OSWorfkow in XML.
There are two items that allow us to use the workflow in this way:
- JIRA lets users edit an issue via Workflow actions even if they don't have the "Edit Issue" permission in the permission scheme
- OSWorkflow doesn't force you to transition to a different step, when executing an action
First, you will need to create a screen containing all the fields you want (and only those fields) the user to be able to edit.
Next you need to create the XML document for the workflow. An easy way to get started is to export a workflow from JIRA as XML
and then edit that.
In each step that you want a specific user group to be able to edit the issue, create an action with the following
- The 'view' should be "fieldscreen"
- "jira.fieldscreen.id" should be set to the screen id that contains the fields you want the user to be able to edit
(if you don't know the ID of the screen you want to use, just reassign the screen, after importing the XML, using JIRA's workflow editor).
- A condition of type "class" with the "class.name" as com.opensymphony.workflow.util.OSUserGroupCondition* The "group" as the JIRA user group the current user must be a member of in order to execute this action
- The resulting step set to the same ID as the step that contains the action
The following is an example:
<action id="2003" name="Edit Issue" view="fieldscreen"> <meta name="jira.fieldscreen.id">10010</meta> <meta name="jira.description">Edit Issue (for Client)</meta> <restrict-to> <conditions> <condition type="class"> <arg name="group">ourclients</arg> <arg name="class.name"> com.opensymphony.workflow.util.OSUserGroupCondition </arg> </condition> </conditions> </restrict-to> <results> <unconditional-result old-status="Not Done" status="Done" step="2"> <post-functions> <function type="class"> <arg name="class.name">com.atlassian.jira.workflow.function.issue.UpdateIssueStatusFunction</arg> </function> <function type="class"> <arg name="class.name">com.atlassian.jira.workflow.function.misc.CreateCommentFunction</arg> </function> <function type="class"> <arg name="class.name">com.atlassian.jira.workflow.function.issue.GenerateChangeHistoryFunction</arg> </function> <function type="class"> <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueReindexFunction</arg> </function> <function type="class"> <arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg> <arg name="eventType">updated</arg> </function> </post-functions> </unconditional-result> </results> </action>
Note that version 2.8 of OSWorkflow allows common actions with a step value of "0" which should result in no change of the step value after executing the action.
However, OSWorkflow 2.8 won't be available in Jira until Jira release 3.7 (see http://jira.atlassian.com/browse/JRA-8902)