Need help troubleshooting a record's related action visibility

I'm trying to allow a certain subset of a user group to see a related action in a record. If the user belongs to GRP_7 AND has authorization for that organization, then the user should be able to see the related action. This code is from the visibility section of the record I'm interested in. I added everything between the comments, everything else is the original code. The part that I added worked on a different record in achieving the same thing, but doesn't seem to work in this case. The user can see related action 'A' and not 'B' but should see both 'A' & 'B'. The following is the SAIL code for the visibility of related action 'B'.

= and(
  or(
    rf!isActive,
    and(
      rf!isActive,
      rf!deactivationDate > now()
    )
  ),
  or(
    rf!Status = cons!PENDING_STATUS,
    rf!Status = cons!NEW_STATUS
  ),
  or(
    isusermemberofgroup(
      loggedInUser(),
      group(
        cons!GRP_1,
        "id"
      )
    ),
    isusermemberofgroup(
      loggedInUser(),
      group(
        cons!GRP_2,
        "id"
      )
    ),
    isusermemberofgroup(
      loggedInUser(),
      group(
        cons!GRP_3,
        "id"
      )
    ),
    isusermemberofgroup(
      loggedInUser(),
      group(
        cons!GRP_4,
        "id"
      )
    ),
    and(
      or(
        isusermemberofgroup(
          loggedInUser(),
          cons!GRP_6
        ),
        isusermemberofgroup(
          loggedInUser(),
          cons!GRP_7
        )
      ),
      rule!IsUserContact(
        userName_txt: loggedInUser(),
        organizationId_int: rf!organizationId
      )
    ),
    /* Is Corporate? AND Authorized? */
    and(
      
      isusermemberofgroup(
        loggedInUser(),
        cons!GRP_7
      ),
      
      contains(
        rule!GetAuthorizedOrgsNumberByUserName(
          loggedInUser()
        ),
        rf!organizationIdentifier
      )
      
    )
    /* END Is Corporate? AND Authorized? */
  )
)

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Use the code below to find out if a user belongs to a particular group using the group name:

    and(
    contains(
    a!forEach(
    tointeger(
    getgroupsformemberuser(
    loggedInUser()
    )
    ),
    group(
    fv!item,
    "groupName"
    )
    ),
    "Put the Group Name for GRP_7 here under quotes"
    ),
    /*Your code which checks authorization*/
    )
  • You can use this code if this variable is integer type

    and(

         isusermemberofgroup(

           loggedInUser(),

           cons!GRP_7

         ),

         contains(

           tointeger(rule!GetAuthorizedOrgsNumberByUserName(

             loggedInUser()

           )),

           rf!organizationIdentifier

         )

    But I thinks visibility rule is correct and there is some problem in process model that you are using as related action as you are saying this code is is working for another related action

    Problems in process may be like:

    1. You are passing the value in process model variable from record which is not a parameter type variable or it have different datatype

    here TriggerSource and productId should be parameter type variable in process model update product and there should be no any start form in process model. You can check it from properties dialog box of process model if there is any start form than please delete it and check the parameter data types.

    2. If this is showing under related actions tab of record but not showing on summary dashboard than click on checkbox under summary view from record.

     

    Thanks

  • Thank you for your response. I have tried this approach and I got the same result as previously (related action is still not visible for the desired user group). I now believe the issue not to be with the code logic itself but elsewhere in the system.
  • Thank you for your response. The rule I'm using to fetch the user's authorized divisions returns a list of text, I had not thought of converting to integer. I will give it a try. I also believe the visibility rule to be correct as I unit tested it extensively at this point.
    The process would actually begin from the record's related action so all the initial data must be pulled from the record. The issue I'm facing is merely the desired user not being able to see the button for the action.
  • Hi oscarb0002,

    Have you checked the security of process model?

    It can be the reason why user can not see related action because if user do not have rights in process model then he can not see related action however your visibility rule is returning true.
    as you are saying the user can see related action 'A' and not 'B', It means security of process model A is different from B.

    so first of all please check the security of process model.

    I hope this will help you.

    Thanks

  • Thank you for your response. You were right, the expression for the visibility was indeed returning true and the problem was the process model security.