.. _user-field-mapping:

User field mapping
-------------------

.. _20.1.1|VOSS-551:
.. _25.2|EKB-25697:

.. tip:: 

   :ref:`use-action-search-to-navigate-automate`


Overview
.........

User field mapping in Automate refers to the alignment of data fields between Automate user data 
and other applications. The field mapping is required when syncing data between Automate and 
other systems. 

To view available field mappings at the current hierarchy and below, go to **User Field Mappings**. 

.. image:: /src/images/user-field-mapping-list.png 


Automate provides a set of default (read-only) field mappings (named ``default``) at the system level (``sys``) hierarchy. The 
default user field mappings are cloned and given an application name whenever an application is added at a 
hierarchy. For example: 

* For CUCM applications, the name may be the IP address
* For LDAP applications, the name may be the business key of the LDAP server  

.. note:: 

   Users are only sourced from CUCM and LDAP (MS LDAP and OpenLDAP) instances so only these instances are 
   created. The ``default`` instances are only visible at ``sys`` level.

   When a CUCM cluster or LDAP server is added at, for example, customer level, these default mappings 
   are cloned down to that customer level, and then become editable.

   LDAP is used for both Microsoft AD and OpenLDAP 

The cloned mapping displays on the **User Field Mappings** page and applies to user management at the hierarchy.

The mapping that applies at the sync hierarchy is used when values are written to Automate 
user data (for an application that is the sync source). 

For example, the default CUCM mapping contains a mapping between the Automate "User Name" and the 
CUCM ``userid``. When syncing user data from a CUCM source, the sync updates the Automate user.

The table describes mapping for applications stored in the ``data/UserFieldMapping`` model. These 
applications create cloned instances at the server level: 


.. tabularcolumns:: |p{5cm}|p{5cm}|p{5cm}|

+------------------+--------------------------------+---------------------+
| Application Name | Model Type                     | UC Source           |
+==================+================================+=====================+
| CUCM             | ``device/cucm/User``           | CUCM                |
+------------------+--------------------------------+---------------------+
| LDAP             | ``device/ldap/user``           | MS Active Directory |
+------------------+--------------------------------+---------------------+
| LDAP             | ``device/ldap/InetOrgPerson``  | OPEN_LDAP           |
+------------------+--------------------------------+---------------------+


When syncing user data from a CUCM source, where this default CUCM field mapping applies at the 
hierarchy, the sync updates the Automate user. You can view the sync source for these users in the **Sync 
Source** column in the list view of the **Users** page. In this case, the sync source is ``CUCM``.

.. important::

   If application users related to a custom field mapping exist in Automate, existing mapped 
   fields are read-only and can't be updated.


You can define up to ten custom values for each of the following field types, which can also be mapped: 

* Up to 10 custom strings
* Up to 10 custom list of strings
* Up to 10 custom booleans
 
After a sync, custom values display on the **Custom** tab of an entry on the **Users/username** page. 



.. rubric:: Related topics 

* For MS_365, see: :ref:`ms-user-field-mapping`


LDAP mappings
................


* LDAP Username

  * For Microsoft Active Directory, this is typically the ``sAMAccountName``.
  * For AD LDS (ADAM), the ``sAMAccountName`` attribute is not part of the default schema,
    but can be added if required. Confirm with the LDAP server administrator. Alternatively,
    use ``uid``.
  * For OpenLDAP, this is typically the ``uid``.

* Sn (Surname)


.. _ms-user-field-mapping:

Microsoft mappings
.....................

This section lists the user mappings from Microsoft users (``device/msgraph/MsolUser``) to Automate 
users. This ``default`` mapping instance in ``data/UserFieldMapping`` is not available for further configuration.

.. note:: 

   For ``email``, Automate captures and stores the primary email address from Microsoft 356 (0365) data where 
   the value for the proxy address field starts with *SMTP* (case-sensitive, all caps). 
   If a value is unavailable (the user 
   doesn't have an Exchange mailbox), the value for UPN 
   (UserPrincipalName) is used. If the user later obtains an Exchange mailbox, since 
   ``PrimarySmtpAddress`` is on the ``device/msgraph/MsolUser`` allowlist, a user sync workflow is 
   triggered to update the user's email address.  



::

   "name": "default"
   "description": "Default MS_365 field mapping"
   "application": "MS_365"
   "model_type": "device/msgraph/MsolUser"
   "username": "UserPrincipalName"
   "email": "PrimarySmtpAddress"
   "first_name": "FirstName"
   "last_name": "LastName"
   "country": "Country"
   "department": "Department"
   "display_name": "DisplayName"
   "city": "City"
   "mobile": "MobilePhone"
   "physical_delivery_office_name": "Office"
   "postal_code": "PostalCode"
   "state": "State"
   "street": "StreetAddress"
   "telephone_number": "PhoneNumber"
   "title": "Title"


.. rubric:: Related topics

* 
  .. raw:: latex

     Allowlists and denylists in the User Guide

  .. raw:: html
  
     <a href="allowlists-and-denylists.html">Allowlists and denylists</a> 



View user field mappings
.........................


To view LDAP and CUCM user field mappings: 

1. Log in to the Admin Portal. 
2. Choose a hierarchy. 
#. Go to **User Field Mappings**. 
#. View the list of mappings at the hierarchy.
#. Click on a user field mapping to view its details. 

   .. important::

      Some fields in the hierarchy-specific field mapping are read-only. Any changes you make 
      apply only to *new* users (field mapping changes won't apply to existing user data at this 
      hierarchy).

   .. image:: /src/images/user-field-mapping-customer-detail.png 






