How to remove optional post functions from the initial transition in a workflow

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

It is not possible to remove or re-order 'essential' post functions when added to the initial transition. The post functions affecting this behavior are:

  • Re-index an issue to keep indexes in sync with the database. 
  • Stores updates to an issue (no change history is created). 
  • Add a comment to an issue if one is entered during a transition. 
  • Set issue status to the linked status of the destination workflow step. 

Cause

When you add a transition to any workflow in JIRA, JIRA automatically adds 5 'essential post functions' to that transition, which cannot be deleted.

On the other hand, a workflow's 'initial transition' only has 2 'essential post functions':

  • One of which is 1 of the 5 'essential post functions' (required for other transitions)
  • The other of which is unique to any workflow's 'initial transition'.

However, you can add the remaining 4 'essential post functions' (required for other transitions) to the 'initial transition', as 'optional post functions'. 

This is a bug tracked here  JRA-25070 - Getting issue details... STATUS

Workaround

This Workaround is For JIRA Server only and does not apply to JIRA Cloud

  1. Download the workflow as XML
     
  2. Locate the initial 'Create Issue' transition, which would look similar to this:

      <initial-actions>
        <action id="1" name="Create Issue">
          <meta name="opsbar-sequence">0</meta>
          <meta name="jira.i18n.title">common.forms.create</meta>
          <validators>
            <validator name="" type="class">
              <arg name="class.name">com.atlassian.jira.workflow.validator.PermissionValidator</arg>
              <arg name="permission">Create Issue</arg>
            </validator>
          </validators>
          <results>
            <unconditional-result old-status="Finished" status="Open" step="1">
              <post-functions>
                <function type="class">
                  <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueCreateFunction</arg>
                </function>
                <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.IssueStoreFunction</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="eventTypeId">1</arg>
                </function>
              </post-functions>
            </unconditional-result>
          </results>
        </action>
      </initial-actions>
  3. Remove the unwanted post functions. In this case we are removing the 4 post functions which can't be removed from the UI, so the XML ends up looking like this:


      <initial-actions>
      <action id="1" name="Create Issue">
        <meta name="opsbar-sequence">0</meta>
        <meta name="jira.i18n.title">common.forms.create</meta>
        <validators>
          <validator name="" type="class">
            <arg name="class.name">com.atlassian.jira.workflow.validator.PermissionValidator</arg>
            <arg name="permission">Create Issue</arg>
          </validator>
        </validators>
        <results>
          <unconditional-result old-status="Finished" status="Open" step="1">
            <post-functions>
              <function type="class">
                <arg name="class.name">com.atlassian.jira.workflow.function.issue.IssueCreateFunction</arg>
              </function>
              <function type="class">
                <arg name="class.name">com.atlassian.jira.workflow.function.event.FireIssueEventFunction</arg>
                <arg name="eventTypeId">1</arg>
              </function>
            </post-functions>
          </unconditional-result>
        </results>
      </action>
    </initial-actions>
  4. Import the workflow XML

Last modified on Mar 21, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.