How to use the Customizer script for Work Logged Team Filter in Dataplane app

This article provides the Dataplane Customizer script for the Work Logged Team Filter.

 Instructions

 

  1. Below is an example of the “Issues Work Log Table” report.

    Configuration:

    Result:



  2. To filter the report by a group of users or as a team, use the below customizer script, and include the user names in the USERS_TO_INCLUDE block.

    USERS_TO_INCLUDE = [ "user1", "user2", . . "userN" ] def includeUser(String user) { return (user != null) && USERS_TO_INCLUDE.contains(user) } customizeResult { def col = getColumn("Work Logged By") Matrix matrix = getMatrix() Matrix newm = matrixFactory.createMatrix() newm.addColumn(matrix.getColumns()) matrix.rows().each { row -> String user = row.getValue(col) if (includeUser(user)) { int rownum = newm.addRow() newm.setRow(rownum, row.getRow()) } } setMatrix(newm) }
  3. Example:


    Result:

     

  4. If no results are displayed in the report with no errors, that means the Customizer Script itself is filtering out all results because user names don not match. The matching of the username in the script should be based on the user’s username.

  1. There is a special Customizer Script for debugging usernames.

    customizeResult { Matrix matrix = getMatrix(); def workedByCol = getColumn("Work Logged By") def NEW_COLUMN_NAME = "Userkey" def NEW_COLUMN_INDEX = matrix.getIndexOfColumn(getColumn("Work Logged By")) + 1; addColumn(NEW_COLUMN_NAME, DataColumnType.TEXT, NEW_COLUMN_INDEX) { row, col -> def workLoggedByUserkey = matrix.getValue(row.getRowNum(), workedByCol) return workLoggedByUserkey } }


    The name of the variables in this script suggests that the report relies on the user’s Jira ‘userkey’ instead of ‘username’. Often they are the same, but not always, refer to https://community.developer.atlassian.com/t/different-between-key-and-username-in-jira-api/37936.

    After running the report with this debug script, click on the “Data” tab and you will see a new report results column with the correct user key/name to use in the Customizer Script in order to match the work log author.


    Result:

     

  2. After finding the user keys, use them instead of user names in the customizer script.