Skip to content

Conversation

@Its-Nmk
Copy link
Contributor

@Its-Nmk Its-Nmk commented Oct 27, 2025

Check User Group Membership Flow Action

This Flow Action is designed to dynamically check if a given user belongs to specified groups based on the provided conditions (OR or AND). It can be used in workflows to make decisions based on group membership, enabling different processes to execute depending on the user's group associations.

Features

  • Dynamic User Check: By default, the logged-in user is checked, but a specific user can also be provided.
  • Group Membership Validation: Checks if the user belongs to one or more groups using the sys_user_grmember table.
  • Flexible Conditions: Supports OR and AND conditions for group membership checks:
    • OR: The user needs to belong to at least one of the specified groups.
    • AND: The user must belong to all the specified groups.

Inputs

  • Operator (String): The condition to check group membership. Accepts OR or AND.
  • Groups (Array): A list of group names or IDs to check against.
  • User SysId (String, Optional): The user ID to check. Defaults to the logged-in user.

Outputs

  • Is Member ? (Boolean): Indicates whether the user satisfies the group membership condition.
  • Is Success ? (Boolean): Indicates whether the operation was successful.

Example Use Case

Decision Making in a Flow:
- If a user belongs to a specific group, execute Process A.
- Otherwise, execute Process B.

Error Handling

If an error occurs during the execution, the following outputs are set:

  • Is Member ?: false
  • Is Success ?: false

The error details are logged for debugging purposes.

How to Use

  1. Add this Flow Action to your workflow.
  2. Provide the required inputs:
    • operator: Specify OR or AND.
    • groups: List of group names or IDs.
    • user (optional): Specify a user ID or leave it blank to use the logged-in user.
  3. Use the outputs (Is Member ? and Is Success ?) to control the flow logic.

@github-actions
Copy link

Valid PR for ActionPack

Thank you for your contribution. This PR complies with the CONTRIBUTING.md.
A maintainer will review this shortly. In the meantime, Happy Hacking!

@snamjosh snamjosh self-assigned this Oct 27, 2025
@snamjosh
Copy link
Contributor

Thank you for your contribution.
Looks good to me.

@snamjosh snamjosh merged commit 5e3b413 into ServiceNowDevProgram:main Oct 27, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants