---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [clients](../index.md) / resolveToInternalRole

# Function: resolveToInternalRole()

> **resolveToInternalRole**(`role`, `mapping`): `string`

Defined in: [packages/b2c-tooling-sdk/src/clients/am-api.ts:155](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/67fb8580ac3c5b372617ee3ec3fc8f2bc9f16174/packages/b2c-tooling-sdk/src/clients/am-api.ts#L155)

Resolves a role to its internal `roleEnumName` using an API-fetched role mapping.
Accepts either the role `id` (e.g., `bm-admin`) or `roleEnumName` (e.g., `ECOM_ADMIN`).
Falls back to a generic transform (uppercase + replace hyphens with underscores) for unknown roles.

## Parameters

### role

`string`

### mapping

[`RoleMapping`](../interfaces/RoleMapping.md)

## Returns

`string`
