#!/usr/bin/env bash # OMNL Fineract — List all clients (paginated): id, accountNo, externalId, displayName. # Use to discover client ids when OMNL_ENTITY_MASTER_DATA accountNo/externalId do not match (e.g. after office migration). # Same credentials as omnl-entity-data-apply.sh (omnl-fineract/.env or repo .env). # Usage: from repo root: ./scripts/omnl/omnl-list-clients.sh # OMNL_CLIENTS_PAGE_LIMIT=200 set -euo pipefail REPO_ROOT="${REPO_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}" # shellcheck source=lib/omnl-fineract-common.sh source "${REPO_ROOT}/scripts/omnl/lib/omnl-fineract-common.sh" omnl_fineract_load_env omnl_fineract_init_curl || exit 1 clients_json=$(omnl_fineract_fetch_all_clients_pageitems) n=$(echo "$clients_json" | jq '.pageItems | length') echo "clients=$n" >&2 echo "$clients_json" | jq -r '.pageItems[] | [(.id|tostring), (.accountNo // ""), (.externalId // ""), (.displayName // .firstname // "")] | @tsv'