How to Fetch DL list from UserGroup Config

,

Hello Everybody.

Introduction

The requirement discussed here is for Harness to be able to pull the Group Email Address, which is defined as part of the Notification Setting in a User Group to be used for automation.

Summary

In Harness, You can add notification settings to Harness User Groups, including group email addresses and Slack channels. When the User Group is assigned an Alert Notification Rule, or added to a Workflow Notification Strategy, the channels you set here will be used to notify them.

There have been requirements from customers to be able to extract this Email address defined at the User Group level and to use it as part of some automation which would involve using the value. There is no direct way to access this Info as a variable for the same does not exist.

Having said that we do have a Solution where we can extract the value of the Group Email Adress using GQL Query.

{
  userGroupByName(name: "mygroup"){
    notificationSettings {
      groupEmailAddresses 
    }
  }
}

The output would look something like below :

{
  "data": {
    "userGroupByName": {
      "notificationSettings": {
        "groupEmailAddresses": [
          "[email protected]"
        ]
      }
    }
  }
}
  1. This query can be executed via HTTP step or curl in a shell script
  2. Use JEXL or jq to extract the required information
  3. Publish the output as context variable to be used in workflow/pipeline scope.
1 Like