Check whether the loggedInUser is in the group or not

Team,

I have a Portal Report of Process Model Context which will have all the tasks. I am using getPortalDataSubset() and converts it into Tempo Report and displaying the same to the end user. I need to place a filter for this report. That is User should see only the tasks pertaining to the user groups he belong to.

Say for example, if the report lists tasks of the groups such as group G1, group G2, group G3 , group G4, group G5.
User A belongs to the groups G2 and G5. When User A login to the report,the user should see the tasks of G2 and G5.
I couldn't use Appian Scripting Functions and related functions such as rule!APN_isLoggedInUserInGroup() , rule!APN_isUserInGroup()
to check whether the loggedInUser is in the group or not.

Please suggest the way to achieve this functionality.

Thanks

OriginalPostID-138726

OriginalPostID-138726

  Discussion posts and replies are publicly visible

Parents
  • sample code - I am not using pagination, but you can pass a standard a!pagingInfo to get paginated results

    /* use a constant which can be modified to point to different report if required */
    local!portalReportId: cons!BW_CMPO_REPORT_TASKS_FOR_BOTW_GROUP,
    /* known groups that are part of CMPO project */
    local!BOTWGroupList: {
    cons!BW_CMPO_GROUP_SALES,
    cons!BW_CMPO_GROUP_QA,
    cons!BW_CMPO_GROUP_TRAINING
    },
    /* User may belong to more than one group. in that case get all CMPO groups. if the user does not belong to known CMPO groups, do not populate users in filter */
    local!userGroupList: index(
    local!BOTWGroupList,
    apply(
    (
    wherecontains(
    _,
    local!BOTWGroupList
    )
    ),
    local!groupsUserIsMemberOf
    ),
    {}
    ),
    /* data set to be displayed as task report */
    local!fulldatasubset: if(
    isnull(
    local!userGroupList
    ),
              /* user must belong to at least one group, else no report gets displayed */
    null,
              /* Portal to SAIL (forum.appian.com/.../112561) */
    getPortalReportDatasubset(
    reportId: local!portalReportId,
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    ),
               /* user group list is the context ids */
    contextIds: {
    local!userGroupList
    },
               /* initially on load, no filters are applied */
    filter: {}
    )
    ),
Reply
  • sample code - I am not using pagination, but you can pass a standard a!pagingInfo to get paginated results

    /* use a constant which can be modified to point to different report if required */
    local!portalReportId: cons!BW_CMPO_REPORT_TASKS_FOR_BOTW_GROUP,
    /* known groups that are part of CMPO project */
    local!BOTWGroupList: {
    cons!BW_CMPO_GROUP_SALES,
    cons!BW_CMPO_GROUP_QA,
    cons!BW_CMPO_GROUP_TRAINING
    },
    /* User may belong to more than one group. in that case get all CMPO groups. if the user does not belong to known CMPO groups, do not populate users in filter */
    local!userGroupList: index(
    local!BOTWGroupList,
    apply(
    (
    wherecontains(
    _,
    local!BOTWGroupList
    )
    ),
    local!groupsUserIsMemberOf
    ),
    {}
    ),
    /* data set to be displayed as task report */
    local!fulldatasubset: if(
    isnull(
    local!userGroupList
    ),
              /* user must belong to at least one group, else no report gets displayed */
    null,
              /* Portal to SAIL (forum.appian.com/.../112561) */
    getPortalReportDatasubset(
    reportId: local!portalReportId,
    pagingInfo: a!pagingInfo(
    startIndex: 1,
    batchSize: - 1
    ),
               /* user group list is the context ids */
    contextIds: {
    local!userGroupList
    },
               /* initially on load, no filters are applied */
    filter: {}
    )
    ),
Children
No Data