Start progress on an issue only after the approval of project manager

Contents


Required apps

Use case

 Let's consider the following case: a Project Manager wants to see and approve each issue before it can be worked on.

Solution

This recipe consists of two different approaches that essentially do the same thing. The first uses just the Power Scripts™ for Jira app and the second one uses both Power Scripts™ for Jira and Power Actions™ for Jira.

In order to complete this tutorial you must be logged in with a Jira account that belongs to the jira-adminstrators group.  


First approach

Start progress on an issue only after the approval of a Project Manager with Power Scripts™ for Jira.

Step 1: Create a new workflow by coping the default Workflow Scheme

  1. Go to the Administration tab and in the Issues menu click the Workflows link.



  2. Copy the default Jira workflow and name it "ApprovingWorkflow".



  3. Click Edit.
  4. In the bottom of the page, add a new status and name it "Approve".



  5. Add another new status and name it "Reject".
  6. Remove all transitions from the Open status.
    To do this, click the Delete Transitions link, select all transitions, and click Delete.



  7. For the Open status named "Approving", click the Add Transition link and fill out the transition fields:
    • Transition Name: "Approve"
    • Destination Step: "Approve"
    • Transition View: "Default Screen"
    Click Add



  8. In the similar way, add a transition for rejecting.



  9. In the similar way, from the Approve status, add the following transitions:
    • Start Progress to the In Progress status
    • Resolve Issue to the Resolve status
    • Close Issue to the Closed status

Step 2: Edit condition for your transition

  1. Set conditions for the Approve and Reject transitions. To do so, click the link on the name of the transition.
    She following screen appears.



  2. Click Add Condition and select (k) SIL™ Condition.
  3. Create a new SIL™ script named: "Approve condition" with the following SIL™ code:

    return currentUser() == projectPM(project);

    The result should look like this:



  4. In the same way, add a script to the Reject transition.

Step 3: Set the Workflow scheme

  1. Select Workflow Schemes on the left of your screen and click Add Workflow Scheme.

     

  2. Create a new Workflow Scheme, name it "ApprovedWorkflowScheme", and click Add.



  3. Click Assign button for the ApprovedWorkflowScheme.
  4. In a new screen, click the Associate an Issue Type with a Workflow button. 
  5. Configure it:
    • Issue Type: "All Unassigned Issue Types"
    • Workflow: "ApprovingWorkflow".

Step 4: Set the new created workflow to your project


a) This is done by selecting the projects tab from the Administration panel and then selecting the Project you want to set your workflow scheme with. You will be transferred to the project page.

b) Select the workflow tab as shown in the picture and then press the "Select a scheme" button from the "Actions" menu.

        

        c) Select the ApprovedWorkflowScheme from the "Associate Workflow Scheme to Project" and press "Associate".

       

        d) And that's it.

        You can now go to your Unopened project Issues and try it.

        Here is an example between the project manager view and the ordinary user view of the project Issue:

       

            vs.

Second approach

Start progress on an issue only after the approval of project manager using Power Actions™ for Jira and Power Scripts™ for Jira.


Step 1: Add Power Action Buttons

After you have install our apps (Power Scripts™ for Jira and Power Actions™ for Jira) on your Jira system create a new Custom field as follows:

a) Go to Administration panel and select the Custom Fields link from the Issues menu.

b) In this screen add a new Custom Field:

c) Create a new Blitz (Power) Actions™ Custom Field and press Next:

d) Name the field "Approve" and choose it's applicable context:

e) Associate the "Approve" custom field with the all available Screens:

f) Configure your Blitz (Power) Actions™ Custom Field by adding two buttons named "Approve" and "Reject":

Select "Edit Buttons" and Add the buttons named "Approve" and "Reject":

g) Edit the Condition Script for both new added buttons:

h) Insert the same following code to both Condition Scripts (for Approve and for Reject). This code allows only the project manager to see those buttons and to press them.

number ENABLED = 1;
number DISABLED = 2;
number HIDDEN = 3;
if(currentUser() == projectPM(project)) {
 return ENABLED;
}
else {
 return HIDDEN;
}

Step 2: Create a text custom field

a) Now we have to create an auxiliary hidden custom field that memorize the state of the issue. If the issue is rejected then this custom field will be setted to "is Rejected" and if the issue is approved then the new custom field is setted to "is Approved".

Let's start with the add a new custom field. Go back to Custom Fields page and add a new Text Field:

b) Name it "Approve Status":

c) Do not show this custom field - this is a security measure because if it is visible it can be editable and the this can modify the behavior. This means that you do not select any of the check boxes shown in the picture bellow.

d) Now you need to find out your custom field ID. For doing this you have to:

    • Enter administration section of Jira
    • Go to Issues Tab >> Custom Fields
    • View Field Configurations
    • Hover the mouse over "Edit" link 
    • URL preview at bottom of browser will include fieldID=....

Our custom field have the ID 10201. You have to remember it because you'll need it later on.

Step 3: Configure the Power Actions™ buttons

a) Now we need to configure the "Screen Script" of our "Approve" and "Reject" buttons. Go back to the Configure screen of the Approve custom field and press the "Screen Script" link for the Approve button.

b) Enter the following SIL™ code:

customfield_{#nnnnn} = "is Approved";
return;

c) Go to "Reject" button and edit the "Screen Script" by adding the following code lines:

customfield_{#nnnnn} = "is Rejected";
return;

Where {#nnnnn} is the ID found before for the Text Custom Field.

Step 4: Create a new Workflow

a) Now we need to create a condition for the transitions from "Open" to "Start Progress", "Resolve Issue" and "Close Issue". The steps are explained with images in the first method of this tutorial. We will summarize the steps:

  • Go to Administration >> Workflows
  • Create a copy of the default Workflow named "jira" and name it "Approve"
  • Edit the transitions of the Approve workflow: Start Progress, Resolve Issue and Close Issue of the Open Step. Add a new SIL™ script condition for these transitions.
  • Enter the following code for each of them:

    return customfield_{#nnnnn} == "is Approved";

    where {#nnnnn} is the custom field ID found on Step 2 d) - In my case is 10201.

These steps are better explained in the Step 2 of the Method 1.

Step 5: Set the Workflow scheme on your project

a) Add the new created workflow to a workflow scheme by creating a workflow scheme named "ApproveScheme" from the "Workflow Schemes" tab of the Workflows screen. This process is better explained in the Step 3 of the Method 1 of this tutorial.

b) After you have created and setted the workflow scheme you have to set the workflow to your project. This is done by:

  • Go to Administration >> Projects
  • Select your desired Jira Project
  • Go to Workflows tab and press Switch scheme button
  • On the next panel you have to select your workflow scheme you created in Step 4.

For a better explication see Step 4 of the first method.


And that is all. You can now go to your issues and see if it's work.

This is the Issue screen before the approval.

This is the Issue screen after the approval.


See also