# Quality External User Templates

The Quality External Collaboration feature set uses the _Quality External User Template_ component for automated creation of _Users_ from _Persons_. These templates attempt to create a _User_ record as per their configurations, filling in requisite information from the values present on the _Person_ record.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: The only license type available for automatically created user accounts is the <em>External User</em> license type. This feature can only be used if your organization has available <em>External User</em> licenses, and if the <em>Person</em>’s email address has a different domain than your corporate email address.</p>
    </div>
  </div>
</div>



## Organization Object Configuration {#organization-object-configuration}

To ensure that there is appropriate data to construct a username for the created user, add a field to the _Organization_ object to contain an appropriate <a href="/en/gr/953/#username">username</a> suffix. For example, _Email Suffix_ (`email_suffix__c`). While this step is optional, it is strongly recommended as doing so will allow you to more easily track and trace _External User_ accounts to the organizations they were created for in the future, and will help avoid conflicts in automatically generated usernames for collaborators.

## Creating a Quality External User Template

To create a _Quality External User Template_:

  1. Navigate to **Admin** > **Configuration** > **Quality External User Templates**.
  2. Click **Create**.
  3. Enter a _Label_ and _Name_ for the template.
  4. Define a [**Username Pattern**][1].
  5. Select a **Security Model**:
     1. **Application Role**: In this model, Vault uses an application role to grant limited <a href="/en/gr/69197/">role-based Vault access</a>. If you are configuring external collaboration for QualityDocs, you must choose this security model. If you are configuring external collaboration for both QualityDocs and QMS, using this security model ensures seamless operation.
     2. **Security Profile**: In this model Vault directly assigns a <a href="/en/gr/23647/">security profile</a> to the external user. This security model is only appropriate for Vaults which use external collaboration within a QMS context only.
  6. Depending on your security model selection, select either an appropriate **Security Profile** or **Application Role** for the user from the applicable drop-down. If selecting a custom security profile, ensure that it does not grant any unnecessary permissions. If you are configuring external collaboration for QualityDocs, you must select the _QualityDocs External Collaborator_ standard application role.
  7. Click **Save**.

## Username Pattern {#username-pattern}

The _Username Pattern_ field on a _Quality External User Template_ defines the resulting username through the use of dynamic tokens. These tokens can take the information from a given _Person_ record or the *Person*'s related _Organization_ record. This field only supports tokens for _Text_, _Number_, _Formula_, and _Lookup_ field values.

This field supports a special token, `${PersonEmailPrefix}`, which resolves to the portion of an email address before the "@" symbol. For example, if the email address listed on the _Person_ record is _Theresa.Ibanez@veesupplier.com_, the token resolves to _Theresa.Ibanez_.

### Example Username Pattern

Below is an example _Username Pattern_ in a Vault with the recommended _Organization_ [object configuration][2]:

`${PersonEmailPrefix}-${Organization.email_suffix__c}` 

For a _Person_ with the email address _Theresa.Ibanez@veesupplier.com_, an _Email Suffix_ value of _VeeSupp_, and whose user account is being activated on the _veepharm.com_ domain, this _Username Pattern_ will resolve to _Theresa.Ibanez-VeeSupp@veepharm.com_. Note that you should ensure that any tokens referenced in the username pattern will not resolve to extremely long values, as generated usernames are still subject to the length and content requirements of a Vault user's username.

 [1]: #username-pattern
 [2]: #organization-object-configuration
