Task Report With Multiple Assignees (User or Group)

On my Site, I have a task report showing a users open tasks assigned to them or the groups they are associated with.

Recently a change was made and there are now instances where a task can be assigned to both a user and a group at the same time.

What I found was that these task entries were not being displayed in my task report.

Previously, I had a this as my logicalExpression in my query for a queryProcessAnalytics



So in order to get this to work for where a task could be assigned to a user and a group at the same time, I changed the above to:

In the above applyComponents, I loop over all my groups and have a queryFilter that tests to see if the task assigned to includes the group.

This works if the user is not a member of a lot of groups, but what I have found is that if the user is a member of a lot of groups, then the report fails because it takes longer than 2 seconds to complete.

The Task Assigned To column in the report I was querying on is of type String. I have tried changing this to User or Group Name, but this does not seem to work.

Does anyone have any suggestions for how to handle the above situation that works?

 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    @benjamins,

    Similar requirement we had. We did the following.

    • Created 2 additional columns in the process report.
      • One for list of users from assignees ... touser(tp!assignees)
      • One for list of groups from assignees ... togroup(tp!assignees)
    • In SAIL form, queryProcessAnalytics(),  include the above additionsl columns as well.
    • Once we retrieve the data , filter the records by using search() and where()..
    • Convert the filtered data to data subset by using todatasubset().
    • Process this data subset and display it in Grid

    Hope it helps you...!!!Please let me know you need more details

     

  • 0
    Certified Lead Developer
    in reply to benjamins

    Please find the below sample code.

    In task report

    c6 - > touser(tp!assignees) , Formatting - > User Name
    c7 - > togroup(tp!assignees) , Formatting - > Group Profile

     

    Hope it will help you...!!!

    --------------------------------------

    local!activeTasks: a!queryProcessAnalytics(
        report: cons!TASK_REPORT,
        contextProcessModels: cons!PROCESS_MODEL,
        query: a!query(      
          pagingInfo: topaginginfo(
            startIndex: 1,
            batchSize: - 1
          )
        )
      ),
      local!assignedusers: index(
        local!activeTasks.data,
        "c6",
        null
      ),
      local!assignedGroups: index(
        local!activeTasks.data,
        "c7",
        null
      ),
      local!activeTasksDataForLoggedinUser: index(
        index(
          local!activeTasks,
          "data",
          {}
        ),
        where(
          or(
            contains(
              touser(
                local!assignedusers
              ),
              loggedInUser()
            ),
            isusermemberofgroups(
              loggedInUser(),
              togroup(
                local!assignedGroups
              )
            )
          )
        )
      )

Reply
  • 0
    Certified Lead Developer
    in reply to benjamins

    Please find the below sample code.

    In task report

    c6 - > touser(tp!assignees) , Formatting - > User Name
    c7 - > togroup(tp!assignees) , Formatting - > Group Profile

     

    Hope it will help you...!!!

    --------------------------------------

    local!activeTasks: a!queryProcessAnalytics(
        report: cons!TASK_REPORT,
        contextProcessModels: cons!PROCESS_MODEL,
        query: a!query(      
          pagingInfo: topaginginfo(
            startIndex: 1,
            batchSize: - 1
          )
        )
      ),
      local!assignedusers: index(
        local!activeTasks.data,
        "c6",
        null
      ),
      local!assignedGroups: index(
        local!activeTasks.data,
        "c7",
        null
      ),
      local!activeTasksDataForLoggedinUser: index(
        index(
          local!activeTasks,
          "data",
          {}
        ),
        where(
          or(
            contains(
              touser(
                local!assignedusers
              ),
              loggedInUser()
            ),
            isusermemberofgroups(
              loggedInUser(),
              togroup(
                local!assignedGroups
              )
            )
          )
        )
      )

Children
No Data