Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This section has use cases which help you understand the usage of the Calculated fields provided by JMCF.

On this page:

Table of Contents

...

This section has use cases which help you understand the usage of the Calculated fields provided by JMCF.

On this page:

Table of Contents

Calculated (scripted) Date/Time custom field type

Calculated (scripted) Date/Time custom field type represents a java.util.Date and is displayed as date+time.

Sample use cases:

  • (lightbulb)Calculate and display the probable date of resolution (excluding weekends) for an issue based on its Priority

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Date/Time custom field type, Probable resolution, from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula in the editor

      Code Block
      Date date(Date from, int nod){
          Calendar c1 = GregorianCalendar.getInstance();
          c1.setTime(from);
        
          int weeks = nod/5;
          int remDays = nod%5;
        
          //Adding whole weeks
          c1.add(Calendar.WEEK_OF_YEAR, weeks);
        
          //Run a loop and check each day to skip a weekend
          for(int i=1;i<=remDays;i++){
            c1.add(Calendar.DAY_OF_MONTH, 1);
          if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
              c1.add(Calendar.DAY_OF_MONTH, 1);
          if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
              c1.add(Calendar.DAY_OF_MONTH, 1);
              }
        
          //Skip ending weekend
          if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
              c1.add(Calendar.DAY_OF_MONTH, 1);
          if (c1.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
              c1.add(Calendar.DAY_OF_MONTH, 1);
        
          //move to 0:00
          c1.clearTime();
            
          return c1.getTime();
      }
      def from = issue.get("created")
      switch (issue.getAsString("priority")) {
       case "Highest" || "High" : return date(issue.get("created"),2);
       case "Medium" : return date(issue.get("created"),4);
       case "Low" || "Lowest" : return date(issue.get("created"),5);
        default : return date(issue.get("created"),5);
      } 


    • Click on Save.
    • Click on Edit Date Format and select DATE_TIME_PICKER.
    • Click on Save.



  • (lightbulb)Calculate and display the Sprint end date as a relative date in the Issue Navigator.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Date/Time custom field type, Sprint end date from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula in the editor

      Code Block
      for (Object sprint : issue.get("Sprint")) {
        if (sprint.isActive())
          return sprint.getEndDate().toDate();
      } 


    • Click on Save.
    • Click on Edit Date Column Format and select RELATIVE.
    • Click on Save.



Calculated (scripted) Duration custom field type

A Calculated (scripted) Duration custom field type represents a duration and is displayed either as a duration string or as a number in a Long format representing the number of seconds.

Sample use cases:

  • (lightbulb) Calculate and display how many days an issue has been open

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Duration custom field type, Open since, from the Custom fields administration page.
    • Click on Configure
    • Click on Edit Groovy formula and write the following formula.

      Code Block
      return ((new Date()).getTime() - issue.created.getTime())/1000L


    • Click on Save.



  • (lightbulb) Calculate the duration the field has been Flagged

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Duration custom field type, Flagged since, from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy formula and write the following formula.

      Code Block
      if(issue.get("Flagged")){
        return (new Date().getTime() - issue.getFieldHistory("Flagged").last().created.getTime())/1000L
      }
      else{
        return null
      }


    • Click on Save.



  • (lightbulb) Calculate and display the number of days from issue creation to resolution in a custom field

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) duration custom field type, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      languagegroovy
      if(issue.get("resolutiondate") == null){
        return null
      }
      return issue.get("resolutiondate") - issue.get("created")


    • Click on Save.



  • (lightbulb) Calculate and display the difference between the current Due date and the last Due date.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Duration custom field type, Due change, from the Custom fields administration page.

    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      import java.text.SimpleDateFormat;
      
      Date curDueDate = issue.get("duedate");
      if (curDueDate == null)
        return null;
      
      if (issue.getFieldHistory("duedate").size() == 0)
          return null;
      oldVal = issue.getFieldHistory("duedate")[-1].getFrom()
      
      if (oldVal==null)
       return null;
      
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
      Date oldDueDate = sdf.parse(oldVal);
      return (curDueDate.getTime() - oldDueDate.getTime())/1000L;


    • Click on Save.



  • (lightbulb) Calculate and display the Total Original Estimate of all the Stories associated to the Epic.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Duration custom field type: Total Original Estimate, from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def totalOE = 0
      	issue.getStories().each{
          totalOE += it.get("timeoriginalestimate",0)   
      }
      return totalOE


    • Click on Save.
    • Select the Duration in the configuration as Duration (Time Tracking Format)



  • (lightbulb) Calculate and display the Remaining Estimate of all the Stories associated to the Epic.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Number custom field type: Total Remaining Estimate, from the Custom fields administration page.

    • Click on Configure.

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def totalRE = 0
      issue.getStories().each{
          totalRE += it.get("timeestimate",0)    
      }
      return totalRE


    • Click on Save.
    • Select the Duration in the configuration as Duration (Time Tracking Format)



Calculated (scripted) Multi-select custom field type

A Calculated (scripted) Multi-select custom field type represents a collection of Options and is displayed as a String representing the option values.

Sample use cases:

  • (lightbulb)  Calculate and display the access to be provided to the user in a custom field based on the project role the user belongs to.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Multi-select custom field type, "Access to" from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Options
    • Add the options to the custom field.
    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      languagegroovy
      if(issue.get("New user")== null)
      return null
      def user = issue.get("New user")
      def roles = []
      def project = issue.get("project")
      if(user.isInProjectRole("Customer Support",project)){
        returnroles += "Jira Service Desk"
      }
      else
      if(user.isInProjectRole("Document writer",project)){
        returnroles += "Confluence"
      }
      else
      if(user.isInProjectRole("Project Manager",project)){
        return "Jira Software"
      }
      else{
        return issue.getAvailableOptions("Access to")
      }
      endifroles += "Jira Software"
      }
      return roles


    • Click on Save.



Calculated (scripted) Multi-user custom field type

A Calculated (scripted) Multi-user custom field type represents a collection of users and is displayed as a String representing the user display names

Sample use cases:

  • (lightbulb) Calculate and display the assignees of the sub-tasks on the parent issue.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Multi-user custom field type, "Assignees of Sub-tasks" from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      languagegroovy
      Set users = []
      issue.get("subtasks").each{
        if(it.assignee)
        {
          users += it.assignee
        }
      }
      return users


    • Click on Save.



Calculated (scripted) Number custom field type

A Calculated (scripted) Number custom field type represents a number and is displayed in Double format. 

Sample use cases:

  • (lightbulb) Calculate and display the number of Stories associated to the Epic.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Number custom field type: Total Stories, from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      if (issue.stories){
        return issue.getStories().size() 
      }
      else{
        return 0
      }


    • Click on Save.



  • (lightbulb) Calculate and display the number of unresolved issues blocking the current issue.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Number custom field type: Number of Blocking Issues, from the Custom fields administration page.

    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      return issue.getLinkedIssues("is blocked by").findAll{
        it.get("resolution") == null
      }.size() 


    • Click on Save.




  • (lightbulb) Calculate and display the number of times "Expected Delivery Date" has been modified.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Number custom field type, Expected Delivery Date updated, from the Custom fields administration page.

    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      return issue.getFieldHistory("Expected Delivery Date").size() 


    • Click on Save.



  • (lightbulb) Calculate and display the number of issues linked to the current issue with link type "Interface" and the Affects Version/s "Platform".

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Number custom field type, Link count, from the Custom fields administration page.

    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def issues = issue.getLinkedIssues("Interface")
      return issues.findAll{
        it.getSourceObject().get("versions")*.name.contains("Platform")
      }.size()
      


    • Click on Save.



Calculated (scripted) Single-select custom field type

A Calculated (scripted) Single-select custom field type represents an Option and is displayed as a String representing an Option value.

Sample use cases:

  • (lightbulb) Calculate and display the company name with logo based on the value provided in the text field holding the URL of the company

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Single-select custom field type:
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      import com.google.common.net.InternetDomainName;
      import java.net.URL;
      import org.apache.commons.validator.routines.UrlValidator;
      
      if (issue.get("URL field")==null)
      return null;
      
      def urlString = issue.get("URL field")
      def urlValidator = new UrlValidator()
      if(urlValidator.isValid(issue.get("URL field")) == false)
      return null;
      
      def url = new URL(urlString)
      def host = url.getHost()
      def name = InternetDomainName.from(host).topPrivateDomain();
      return name.parts()[0].toUpperCase()


    • Click on Save.
    • Click on Edit Velocity template and write the following template

      Code Block
      #if ($value == "AMAZON")
      	<img src='https://images-na.ssl-images-amazon.com/images/I/31YAf-cs2oL._AC_UL160_.jpg'  width=30px >$value
      #elseif ($value == "MYNTRA")
      	<img src='https://images-na.ssl-images-amazon.com/images/I/31YAf-cs2oL._AC_UL160_.jpg'  width=30px >$value
      #else
      	return $value
      #end




Calculated (scripted) Single-user custom field type

A Calculated (scripted) Single-user custom field type represents an ApplicationUser and is displayed as a String representing the display name of the user.

Sample use cases:

  • (lightbulb) Calculate and display the user who last commented on the issue

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Single-user custom field type: Last Commented by, from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      if(issue.get("comment")){
        return issue.get("comment").last().authorApplicationUser
      }
      else{
        return null
      }


    • Click on Save.



  • (lightbulb) Calculate and display the user who last modified the issue

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Single-user custom field type: Last Modified by, from the Custom fields administration page.
    • Click on Configure

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
      def changeItems = changeHistoryManager.getAllChangeItems(issue)
       
      if (changeItems?.size() > 0) {
      def userManager = ComponentAccessor.getUserManager() ;
      def userkey = changeItems.sort(false).last().getUserKey();
      userManager.getUserByKey(userkey);
      } else {
      null
      }


    • Click on Save.



Calculated (scripted) Text/Html custom field type

A Calculated (scripted) Text/Html custom field displays text calculated using a Groovy script and supporting HTML formatting.

Sample use cases:

  • (lightbulb) Calculate and display the last comment, its author, and timestamp in a text field.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Last comment details, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      if(issue.get("comment")){
        return "Comment body: " + issue.get("comment").last().getBody() + "\n" +
          "Comment Author: " + issue.get("comment").last(). getAuthor() + "\n" + "Comment timestamp: " + issue.get("comment").last().getUpdated()
      }
      else{
        return null
      }


    • Click on Save.



  • (lightbulb) Calculate and display the current issues' linked issues with "is blocked by" link type and are not in Resolved or Closed status.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Blocking issues, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      return issue.getLinkedIssues("is blocked by").findAll{
        it.get("status").name!= "Resolved" || it.get("status").name!= "Closed"
      }*.key.join(",")


    • Click on Save.



  • (lightbulb) Calculate and display all the previous due dates as comma separated list with dates in YYYY-MM-DD format.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Previous Due dates, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def dueDates = ""
      issue.getFieldHistory("duedate").each{
        if(it.getFrom()){
          dueDates += it.getFrom() + "\n"
        }
      }
      return dueDates


    • Click on Save.



  • (lightbulb) Calculate and display estimated hours for each day, using not more than 8 hours per day, until the due date.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Daily estimates, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      import org.apache.commons.lang.StringUtils;
      import java.text.SimpleDateFormat;
       
      dateStrings = new ArrayList();
      dateFormat = new SimpleDateFormat("yyyy-MM-dd");
       
      dueDate = issue.get("duedate");
      estimate = issue.get("timeoriginalestimate");
       
      if (dueDate != null && estimate != null && estimate != null && estimate > 0) {
        calendar = Calendar.getInstance();
        calendar.setTime(dueDate); estimate > 0) {
        calendar = Calendar.getInstance();
        calendar.setTime(dueDate);
        hours = estimate / 3600.0;
       
        while (hours > 0) {
          dateHours = hours > 8 ? 8 : hours;
          dateStrings.add(
            dateFormat.format(calendar.getTime()) + "," +
            String.valueOf(dateHours) + " hours"
          );
          hours -= estimatedateHours;
         / 3600.0calendar.add(Calendar.DATE, -1);
          whileif (hours > 0) {(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
           dateHours = hours > 8 ? 8 : hours;	calendar.add(Calendar.DAY_OF_MONTH, -1)
          if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
          dateStrings	calendar.add(Calendar.DAY_OF_MONTH, -1)
        }
      }
       
      if dateFormat.format(calendardateStrings.getTimeisEmpty()) + "," +
            String.valueOf(dateHours) + " hours"
          );
          hours -= dateHours;
          calendar.add(Calendar.DATE, -1);
          if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
          	calendar.add(Calendar.DAY_OF_MONTH, -1)
          if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
          	calendar.add(Calendar.DAY_OF_MONTH, -1)
        }
      }
       
      if (dateStrings.isEmpty()) return null;
      return StringUtils.join(dateStrings, "\n")return null;
      return StringUtils.join(dateStrings, "\n");


    • Click on Save.



  • (lightbulb) Calculate and display the location of the Assignee of the issue from the User properties

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Location, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def currentUserProps = ComponentAccessor.getUserPropertyManager().getPropertySet(issue.get("reporter"));
      def metaLoc = currentUserProps.getType("jira.meta.location")
      return currentUserProps.getString(metaLoc,"jira.meta.location");


    • Click on Save.



  • (lightbulb) Calculate and display all the comments of a specific user.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Comment from John Doe, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      String s = "";
      issue.get("comment").each{
        if (it.getAuthorApplicationUser().getName().equals("jdoe")) {
      	s += "On "+ it.getCreated().toLocaleString() + " Dashboard meeting.\n";
      	s += "Comment by " + it.getAuthorFullName() + ":\n";
          s += it.getBody() + "\n";
        }
      }
      return s;


    • Click on Save.



  • (lightbulb) Calculate and display the

    location of the Assignee

    Project category of the issue

    from the User properties

    's project

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Location Project Category, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      def currentUserProps = ComponentAccessor.getUserPropertyManager().getPropertySet(issue.get("reporterproject"));
      def metaLoc = currentUserProps.getType("jira.meta.location")
      return currentUserProps.getString(metaLoc,"jira.meta.location");.getProjectCategoryObject().getName()


    • Click on Save.



  • (lightbulb)

     Calculate and display all the comments of a specific user

     Flag the issue on the issue view screen if the has been flagged.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Comment from John Doe Flag, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      String s = "";
      issue.get("comment").each{
        if (it.getAuthorApplicationUser().getName().equals("jdoe")) {
      	s += "On "+ it.getCreated().toLocaleString() + " Dashboard meeting.\n";
      	s += "Comment by " + it.getAuthorFullName() + ":\n";
          s += it.getBody() + "\n";
        }
      }
      return s;
    • Click on Save.
    (lightbulb) Calculate and display the Project category of the issue's project
    • return issue.get("Flagged")


    • Click on Save.
    • Click on Edit Velocity template and write the following template

      Code Block
      #if ($value != null)
      <div class="ghx-iconfont aui-icon aui-icon-small aui-iconfont-flag">
          $formattedValue
      </div>
      #else
          $value
      #end




Calculated (scripted) Wiki Text custom field type

A Calculated (scripted) Wiki custom field displays text calculated using a Groovy script and optionally supporting wiki-style formatting.

Sample use cases:

  • (lightbulb) Calculate and display the last comment, its author, and timestamp in a text field without escaping the formatting .

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html custom field type: Project Category Last comment details, from the Custom fields administration page.
    • Click on Configure 

    • Click on Edit Groovy Formula and write the following formula.

      Code Block
      Code Block
      if(issue.get("comment")){
        return "Comment body: " + issue.get("comment").last().getBody() + "\n" +
          "Comment Author: " + issue.get("comment").last(). getAuthor() + "\n" + "Comment timestamp: " + issue.get("projectcomment").getProjectCategoryObjectlast().getNamegetUpdated()
      }
      else{
        return null
      }


    • Click on Save.
    (lightbulb) Flag the issue on the issue view screen if the has been flagged.



Last Field Value Change Author custom field type

A Last Field Value change Author custom field type that represents the author of the last modification made to a field and is displayed as a String representing the display name of the user.

Sample use cases:

  • (lightbulb) Calculate and display the author who has last added this issue to a Sprint

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html Last Field Value Change Author custom field type: Flag Moved to Sprint by, from the Custom fields administration page.
    • Click on Save

      Click on Configure 

      Click on Edit Groovy Formula and write the following formula.

      Code Block
      return issue.get("Flagged")

      Edit Field to look for

    • Select the Sprint field.
    • Click on Edit Velocity template and write the following template
      Code Block
      #if ($value != null)
      <div class="ghx-iconfont aui-icon aui-icon-small aui-iconfont-flag">
          $formattedValue
      </div>
      #else
          $value
      #end

...

    • Save



Last Field Value Change Date/Time custom field type

A Calculated (scripted) Wiki custom field displays text calculated using a Groovy script and optionally supporting wiki-style formattingLast Field Value Change Date/Time custom field type represents java.util.Date and is displayed as date+time.

Sample use cases:

  • (lightbulb) Calculate and display the last

    comment, its author, and timestamp in a text field without escaping the formatting

    time the issue was Flagged.

    Expand
    titleSteps


    Panel
    • Create a Calculated (scripted) Text/Html Last Field Value Change Date/Time custom field type: Last comment details Last Flagged, from the Custom fields administration page.
    • Click on Configure 

      Click on Edit Groovy Formula and write the following formula.

      Code Block
      if(issue.get("comment")){
        return "Comment body: " + issue.get("comment").last().getBody() + "\n" +
          "Comment Author: " + issue.get("comment").last(). getAuthor() + "\n" + "Comment timestamp: " + issue.get("comment").last().getUpdated()
      }
      else{
        return null
      }
    • Click on Save.

Last Field Value Change Author custom field type

...

    • Edit Field to look for

    • Select the Flagged field.
    • Click on Save



Parent Status custom field type

A Parent status calculated custom field type represents the status of the issue's parent issue, if any, and is displayed as a String representing the status name.

Sample use cases:

  • (lightbulb) Calculate and display the status of the parent issue and the name of the user to whom the issue is assigned.

    Expand
    titleSteps


    Panel
    • Create a Parent Status custom field type: Parent Status field, from the Custom fields administration page.
    • Click on Edit Velocity Template

    • Write the following template


      Code Block
      #if ($issue.assignee.name)
      	$formattedValue and assigned to $issue.assignee.displayName
      #else
      	$formattedValue
      #end




Status entered by user custom field type

A Status entered by user custom field type represents a user who last (or first) moved the issue to the specified status and is displayed as a String representing the user display name.

Sample use cases:

  • (lightbulb) Calculate and display the author

    who has last added this issue to a Sprint

    name and the email address of the user who first Approved the issue

    Expand
    titleSteps


    Panel
    • Create a Last Field Value Change Author Status entered by user custom field type: Moved to Sprint by, First Approved on, from the Custom fields administration page.
    • Click on Edit Field Statuse(s) to look for.
    • Select the Sprint field.Approval status.
    • Select Earliest from Which transition execution field
    • Click on Save

...

    • .



Status entered on date/time custom field type

A  Last Field Value Change Status entered on Date/Time custom field type represents java.util.Date and is  represents a date+time the issue has been last (or first) moved to the specified status and is displayed as date+time.

Sample use cases:

  • (lightbulb) Calculate and display the

    last

    date/time

    the issue was Flagged.

    an issue entered the Approval status for the first time

    Expand
    titleSteps


    Panel
    • Create a Last Field Value Change Date/Time Status entered on date/time custom field type: Last Flagged, First Approved on, from the Custom fields administration page.
    • Click on Edit Field Statuse(s) to look for.
    • Select the Flagged field.Approval status.
    • Select Earliest from Which transition execution field
    • Click on Save.

...




Time in status custom field type

A Parent status calculated custom field type represents the status of the issue's parent issue, if any,  Calculated Time in status custom field type represents a duration and is displayed either as a String representing the status nameduration String or as a number in a Long format representing the number of seconds.

Sample use cases:

  • (lightbulb)

     Calculate

     Calculate and display the

    status of the parent issue and the name of the user to whom the issue is assigned.

    time spent in the Pull request status

    (lightbulb) Calculate and display the author name and the email address of the user who first Approved the issue
    Expand
    titleSteps


    Panel
    • Create a Parent Status custom field type: Parent Status field, Time in status custom field type, Time in Pull request, from the Custom fields administration page.
    • Click on Edit Velocity TemplateWrite the following template
      Code Block
      #if ($issue.assignee.name)
      	$formattedValue and assigned to $issue.assignee.displayName
      #else
      	$formattedValue
      #end

Status entered by user custom field type

A Status entered by user custom field type represents a user who last (or first) moved the issue to the specified status and is displayed as a String representing the user display name.

Sample use cases:

    • Statuse(s) to look for.
    • Select the statuses you would like the calculated field to look for.
    • Click on Save.



  • (lightbulb) Calculate and display the total resolution time for a ticket in an error banner if the time spent is more than 3 days

    (lightbulb) Calculate and display the date/time an issue entered the Approval status for the first time
    Expand
    titleSteps


    Panel
    • Create a Status entered by user Time in status custom field type, First Approved onTotal resolution time, from the Custom fields administration page.
    • Click on Edit Statuse(s) to look for.
    • Select the Approval status.Select Earliest from Which transition execution fieldIn Progress from the list of statuse(s)
    • Click on Save.

Status entered on date/time custom field type

A Status entered on Date/Time custom field type represents a date+time the issue has been last (or first) moved to the specified status and is displayed as date+time.

Sample use cases:

    • Click on Edit Velocity Template
    • Write the following template

      Code Block
      #if ($value > 252900)
      <div class="aui-banner aui-banner-error">
      	$formattedValue
      </div>
      #else
      	$formattedValue
      #end




  • (lightbulb) Calculate and display the time spent in current status

    Expand
    titleSteps


    Panel
    • Create a Status entered on date/time Time in status custom field type, First Approved onTotal resolution time, from the Custom fields administration page.
    • Click on Edit Statuse(s) to look for.
    • Select the Approval status.Select Earliest from Which transition execution fieldCurrent Status from the list of statuse(s)
    • Click on Save.

...



Transition Caller custom field type

A Calculated Time in status custom field type represents a duration and is displayed either as a duration String or as a number in a Long format representing the number of seconds.

Sample use cases:

(lightbulb) Calculate and display the time spent in the Pull request status

...

titleSteps
Panel
  • Create a Time in status custom field type, Time in Pull request, from the Custom fields administration page.
  • Click on Edit Statuse(s) to look for.
  • Select the statuses you would like the calculated field to look for.
  • Click on Save.

...

Transition Caller custom field type returns the user who first/last executed a specific workflow transition and is displayed as a String representing the display name of the user.

Sample use cases:

  • (lightbulb) Calculate and display the author who last fixed the issue

    Expand
    titleSteps


    Panel
    • Create a
  • Time in status
    • Transition caller custom field type,
  • Total resolution time
    • Last fixed by, from the Custom fields administration page.
    • Click on Edit
  • Statuse
    • Transition(s) to look for.
  • Select In Progress from the list of statuse(s)
    • Provide the transition name or ID of the transition to Fixed status, either manually or using the Transition picker
    • Click on
  • Save.
  • Click on Edit Velocity Template
  • Write the following template

    Code Block#if ($value > 252900) <div class="aui-banner aui-banner-error"> $formattedValue </div> #else $formattedValue #end
    • Add.
    • Click on Save.
    • Select Latest from the Transition Execution field.



  • (lightbulb) Calculate and display

  • the time spent in current status
  • the author who has resolved the issue across different workflows with different transitions.

    Expand
    titleSteps


    Panel
    • Create a
  • Time in status
    • Transition caller custom field type,
  • Total resolution time
    • Last fixed by, from the Custom fields administration page.
    • Click on Edit
  • Statuse
    • Transition(s) to look for.
  • Select Current Status from the list of statuse(s)
  • Click on Save.

Transition Caller custom field type

A Transition Caller custom field type returns the user who first/last executed a specific workflow transition and is displayed as a String representing the display name of the user.

...

    • Click on the Transition picker.
    • Select the workflow name and the transition that leads to the Resolved status
    • Click on Add
    • Repeat the same with all the other transitions that lead to Resolved status.
    • Click on Save.
    • Select Latest from the Transition Execution field.



  • (lightbulb) Calculate and display the

    author who last fixed

    creator of the issue along with his/her username.

    Expand
    titleSteps


    Panel
    • Create a Transition caller custom Caller Custom field type, Last fixed by,  Owner from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.
    • Provide the Create transition name or ID of the transition to Fixed status, either manually or using the Transition picker
    • Click on Add.
    • Click on Save.
    • Click on Edit Velocity Template.
    • Select Latest from the Transition Execution field.
    • Input the following template.

      Code Block
      #if ($value)
      	$formattedValue - $value.name
      #end


    • Click on Save.



Transition Callers custom field type

A Transition Callers custom field type rreturns the users who triggered a specific workflow transition and is displayed as a String representing the display names of the users.

Sample use cases:

  • (lightbulb) Calculate and display the

    author who has resolved the issue across different workflows with different transitions.

    authors who approved the ticket

    Expand
    titleSteps


    Panel
    • Create a Transition caller callers custom field type, Last fixed Approved by, from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.Click on the Transition picker.
    • Select the workflow name and the transition that leads to the Resolved status"Approve" transition using the Transition picker
    • Click on AddRepeat the same with all the other transitions that lead to Resolved status.
    • Click on Save.Select Latest from the Transition Execution field.



  • (lightbulb) Calculate and display the

    creator of the issue along with his/her username.

    authors who have Reviewed and Approved the ticket

    Expand
    titleSteps


    Panel
    • Create a Transition Caller Custom callers custom field type, Reviewed and Owner Approved by, from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.
    • Provide the Create transition name or ID either manually or Select the "Approve" and "Review" transitions using the Transition picker
    • Click on Add.
    • Click on Save.
    • Click on Edit Velocity Template.
    • Input the following template.

      Code Block
      #if ($value)
      	$formattedValue - $value.name
      #end
      Click on Save.



Transition Count custom field type

A Transition Count custom field represents the number of times a specified workflow transition(s) was executed and is displayed as a number in Double format.

Sample use cases:

  • (lightbulb) Calculate and count the number of times an issue fix has been rejected

    Expand
    titleSteps


    Panel
    • Create a Transition Count Custom field type, Rejected, from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.
    • Provide the transition name or ID of the transition "Reject" either manually or using the Transition picker
    • Click on Add.
    • Click on Save.



  • (lightbulb) Calculate the number of revisions done on a story before moving into development.

    Expand
    titleSteps


    Panel
    • Create a Transition Count Custom field type, Revisions, from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.
    • Provide the transition name or ID of the transition "Needs revision" either manually or using the Transition picker
    • Click on Add.
    • Click on Save.



Transition Date/Time custom field type

A Transition Date/Time custom field type represents a java.util.Date and is displayed as date+time. 

Sample use cases:

  • (lightbulb) Calculate and display the date/time as a relative time when the issue has been last approved.

    Expand
    titleSteps


    Panel
    • Create a Transition Date/Time Custom field type, Last Approved on, from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.
    • Provide the transition name or ID either manually or using the Transition picker
    • Click on Add.
    • Click on Save.
    • Select Latest from the Transition Execution field.
    • Click on Edit Date Format
    • Select RELATIVE
    • Click on Save



  • (lightbulb) Calculate and display the "Fix date" when an issue is moved to Fixed/Checked-in status for the first time

    Expand
    titleSteps


    Panel
    • Create a Transition Date/Time Custom field type, Fix date, from the Custom fields administration page.
    • Click on Edit Transition(s) to look for.
    • Click on the Transition picker.
    • Select the workflow name and the transition that leads to the respective status
    • Click on Add
    • Repeat the same with the other transitions of the workflows.
    • Click on Save.
    • Select Earliest from the Transition Execution field