# Automatic Application User Mapping to GRAVITY Audiences The idea behind GRAVITY's [[Audiences]] is to limit the visibility of a Callout/Hotspot to certain users. You can build Audiences manually or by a rule set. GRAVITY can take advantage of automatic user mapping to audiences using the target applications user roles. By leveraging role information from such applications, users are automatically placed into the relevant audience, simplifying the process of audience creation and maintenance. The configuration for Automatic Application User Mapping is done within the application settings rather than at the site level. To set up, go to Applications, select the application you wish to configure for editing, and navigate to the Audience Automapping tab. ![[1.28-audience-automapping.png]] # Microsoft Dynamics Audience auto-mapping integration allows to read the list of roles assigned to the logged-in user. ## Data extraction configs **USER_ROLE_ID** - uses unique identifiers of the roles Example of auto-mapping config: ``` roleId=aa62903c-393b-ef11-a317-002248db3b92 -' users with the specific roleId ``` **USER_ROLE_NAME** - uses names of the roles Example of auto-mapping config: ``` roleName=.*Administrator.* - users with any 'Administrator' role ``` # Salesforce Audience auto-mapping integration allows to execute Salesforce Object Query to get information available for the logged-in user. > [!Prerequisite] > * Users must have the permission to execute Salesforce API calls > * Properties used in the configuration must be available for all users > ## Examples of data extraction configs ``` select Email, userRole.Name, Profile.Name from user where id='$user_id select DeveloperName, Name from Group where id in (select GroupId from GroupMember where UserOrGroupId = '$user_id) ``` Examples of auto-mapping config: ``` Profile.Name=System Administrator - users with 'System Administrator' profile UserRole.Name=Boss - users with 'Boss' role DeveloperName=SalesTeam - users with a public group 'Sales team' ``` ``` select PermissionsCanAccessCE from UserPermissionAccess ``` Example of auto-mapping config: ``` PermissionsCanAccessCE=true - users with the permission given ```