How can I get all the tasks where loggedInUser is an Assignee

Certified Senior Developer

Have a task report with an "Assigned To" column which can have multiple users based on the task type.

Using queryProcessAnalytics() in one of the task reports to get the tasks where logged in user is a part of the assignees.

Using the following query filter :
a!queryFilter(field:"c1",operator:"includes",value:loggedInUser()),

But its not working as expected. How can I get all the tasks where loggedInUser is an Assignee.

Thanks in advance.

OriginalPostID-216672

OriginalPostID-216672

  Discussion posts and replies are publicly visible

Parents
  • I would like to make a confirmation here on what I have mentioned earlier as I see in the last comment that it's interpreted in a different way than intended:

    I should say that two reports aren't needed at all. We just need only one Portal Report and this Portal Report should be able to get the Task Information based on User Context(to be specific, 'Tasks Per User' category). Along with the Task Information, the Report should also hold Process Model Id (with pm!id as value) as a column. Attached a screen shot which says how the basic contents in it should look like. And here's how we write the query to accomplish the use-case discussed in this post by @vikrantb.


    fn!load(
              local!contextUsers:{},
              /*Populate the local!contextUsers with the desired users. Example: fn!touser({"user1","user2"})*/
              local!report: null,
              /*Populate the local!report with the Report document or document id of the Report*/
              local!desiredProcessModelIds: {},
              /*Populate the local!desiredProcessModelIds with the Process Model Ids or a constant that holds multiple values of type Process Model*/
              local!portalReportDataSubset: a!queryProcessAnalytics(
               report: local!report,
               contextUsers: local!contextUsers,
               query: a!query(
                        pagingInfo: a!pagingInfo(startIndex: 1, batchSize: -1),
                        logicalExpression: a!queryLogicalExpression(
                         operator: "AND",
                         filters: {
                                  a!queryFilter(field: "c7", operator: "in", value: local!desiredProcessModelIds)
                                  /*Replace c7 with the field that represents Process Model Id*/
                         }
                        )
               )
              ),
              fn!if(
                        local!portalReportDataSubset.totalCount = 0,
                        null,
                        /*Remove duplicates*/
                        fn!union(fn!cast(fn!typeof(local!portalReportDataSubset.data),{}),local!portalReportDataSubset.data)
              )
    )


Reply
  • I would like to make a confirmation here on what I have mentioned earlier as I see in the last comment that it's interpreted in a different way than intended:

    I should say that two reports aren't needed at all. We just need only one Portal Report and this Portal Report should be able to get the Task Information based on User Context(to be specific, 'Tasks Per User' category). Along with the Task Information, the Report should also hold Process Model Id (with pm!id as value) as a column. Attached a screen shot which says how the basic contents in it should look like. And here's how we write the query to accomplish the use-case discussed in this post by @vikrantb.


    fn!load(
              local!contextUsers:{},
              /*Populate the local!contextUsers with the desired users. Example: fn!touser({"user1","user2"})*/
              local!report: null,
              /*Populate the local!report with the Report document or document id of the Report*/
              local!desiredProcessModelIds: {},
              /*Populate the local!desiredProcessModelIds with the Process Model Ids or a constant that holds multiple values of type Process Model*/
              local!portalReportDataSubset: a!queryProcessAnalytics(
               report: local!report,
               contextUsers: local!contextUsers,
               query: a!query(
                        pagingInfo: a!pagingInfo(startIndex: 1, batchSize: -1),
                        logicalExpression: a!queryLogicalExpression(
                         operator: "AND",
                         filters: {
                                  a!queryFilter(field: "c7", operator: "in", value: local!desiredProcessModelIds)
                                  /*Replace c7 with the field that represents Process Model Id*/
                         }
                        )
               )
              ),
              fn!if(
                        local!portalReportDataSubset.totalCount = 0,
                        null,
                        /*Remove duplicates*/
                        fn!union(fn!cast(fn!typeof(local!portalReportDataSubset.data),{}),local!portalReportDataSubset.data)
              )
    )


Children
No Data