# UTIL_FeatureFlag.INT_UserAwareFeatureFlagStrategy

**Class** · Group: `Feature Flags`

Learn it: [Fast Start - Feature Flags](/fast-start-feature-flags) and [Feature Flags guide](/feature-flags-guide)

<div class="apex-member apex-class">

```apex
global interface UTIL_FeatureFlag.INT_UserAwareFeatureFlagStrategy implements UTIL_FeatureFlag.INT_FeatureFlagStrategy
```

**Implements:** [UTIL_FeatureFlag.INT_FeatureFlagStrategy](/reference/apex/util-featureflag-int-featureflagstrategy)

Extended interface for custom strategies that support user context evaluation. Implement this interface instead of INT_FeatureFlagStrategy when your custom strategy needs to evaluate for a specific user (not just the running user). IMPORTANT: You must implement BOTH methods: isEnabled() for backward compatibility and running user scenarios isEnabledForUser() for explicit user context scenarios The recommended pattern is to have isEnabled() delegate to isEnabledForUser().

**Example**

```apex
public class MY_Region_Strategy implements UTIL_FeatureFlag.INT_UserAwareFeatureFlagStrategy
{
    public Boolean isEnabled(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate)
    {
        return isEnabledForUser(flag, strategyToEvaluate, UserInfo.getUserId());
    }
    public Boolean isEnabledForUser(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate, Id userId)
    {
        User targetUser = new SEL_User().findById(userId);
        List<String> allowedCountries = strategyToEvaluate.Target__c.split(',');
        return allowedCountries.contains(targetUser.Country);
    }
}
```

</div>

---

## Methods

| Method | Description |
|--------|-------------|
| global abstract [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) [isEnabledForUser](#isenabledforuser)([FeatureFlag__mdt](/reference/metadata/featureflag-mdt) flag, [FeatureFlagStrategy__mdt](/reference/metadata/featureflagstrategy-mdt) strategyToEvaluate, [Id](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm) userId) | The framework calls this only when it checks a flag for a user who is not the running user, through UTIL_FeatureFlag.isEnabled with a user Id or a username. |

### isEnabledForUser

<div class="apex-member">

```apex
global abstract Boolean isEnabledForUser(FeatureFlag__mdt flag, FeatureFlagStrategy__mdt strategyToEvaluate, Id userId)
```

The framework calls this only when it checks a flag for a user who is not the running user, through
UTIL_FeatureFlag.isEnabled with a user Id or a username. For the running user it calls isEnabled instead. Read
the user's details from userId, never from UserInfo.

**Parameters**

| Parameter | Type | Description |
|-----------|------|-------------|
| `flag` | [FeatureFlag__mdt](/reference/metadata/featureflag-mdt) | The parent Feature Flag custom metadata record |
| `strategyToEvaluate` | [FeatureFlagStrategy__mdt](/reference/metadata/featureflagstrategy-mdt) | The specific strategy record being evaluated |
| `userId` | [Id](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_id.htm) | The user to evaluate the strategy for (may differ from running user) |

**Returns** [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm) — `true` if the feature is enabled for the specified user by this strategy

</div>
