This site requires JavaScript to be enabled
External Customer KB > General > Attribute Macros
Attribute Macros
Article: KB0010609 Published: 05/16/2024 Last modified: 05/16/2024

Attribute macros are used in OneLogin provide placeholders that will be automatically filled in with user attributes and other unique data, such as a username, a certificate address, a given app's error message, or a randomly generated password or UUID. They're perfect for customizing personalized messaging for your users or creating powerfully flexible app parameters and user mappings.

Using Macros

Using Macros In Templates and Notifications

Attribute macros can be used to personalize the messages automatically distributed to you and your users by the notifications and branding settings you have configured. When configuring these templates, enclose the macro in a double set of curly braces ({{ }}). For example, a template written with these macros may be modified like so:


  Hello {{name}},
  You have been invited to join {{account_name}}'s Single Sign-On Portal at the link below:

  {{account_url}}?email={{email}}

  Email: {{email}}

  Password: Your {{directory_name}} password

  Hello Bruce,
  You have been invited to join Wayne Corp's Single Sign-On Portal at the link below:

  https://waynecorp.onelogin.com/login2/?email=bwayne@waynecorp.com

  Email: bwayne@waynecorp.com

  Password: Your BatSuite Directory password

Note: While branding and invitation templates may accept macros written with {single braces}, notifications must use {{double braces}} in order to populate the correct content.

Using Macros With User Parameters

Attribute macros can also be used to enhance your user mappings in OneLogin and provisioning with other apps or directories. When configuring these parameters, enclose the macro in a single set of curly braces ({ }). For example, if all your users have accounts in another app that follow a "lastname.firstname" username format, you could map the Username attribute to {lastname}.{firstname} in the app's Parameters.

Important: Attribute macros cannot be used with password parameter types

Note: Attribute macros are not to be confused with the - Macro - attribute available to select in the Value field when configuring app parameters. While attribute macros can be, and often are, used in the - Macro - field text, this is not required and the attribute macros and - Macro - field are not directly related.

 


 

List of Available Macros

These are all attribute macros currently available to be used with templates and/or user parameters in OneLogin. Remember to enclose the macro in {single} or {{double}} curly braces according to the context where it's being used.

Note: Not all macros can be used on all occasions. For example, the {{password_url}} macro intended to insert a unique password-reset URL into an invitation email will not function correctly in a mapping or app parameter, or the {{app_name}} macro will not populate if used in a notification that is not triggered by any given app's activity.

Always test your macros before use.

Macro

Action

Templates & Notifications

Parameters

account.owner.name

Inserts the full name of the account owner

 

account.users_count

Inserts the current total number of users licensed to the account

 

account_name

Inserts the name of the account

account_url

Inserts the account's OneLogin link (e.g. https://example.onelogin.com)

active_directory_connector.name

Inserts the name of the relevant AD connector

 

app_error

Inserts the error message generated by the affected application

 

app_name

Inserts the name of the relevant application

 

assumed_by

Inserts the full name of the user assuming the relevant user account

 

assuming_reason

Inserts the text entered by the assuming user when assuming the account

 

authentication_factor_name

Inserts the name of the relevant authentication factor

 

authentication_factor_type

Indicates the type of authentication factor

 

certificate.name

Inserts the name of the relevant OneLogin certificate

 

certificate.remaining_days

Inserts the number of days remaining before the certificate expires

 

certificate.url

Inserts the certificate's unique address

 

custom_attribute_shortname

Inserts the content of any custom field you have configured

 

department

Inserts the user's department attribute

directory.edit_url

Inserts an admin link for editing the relevant third-party directory in OneLogin

 

directory_name

Inserts the directory associated with the affected user

email

Inserts the user's email address

email_domain_part

Inserts just the domain of the user's email address (e.g. user@example.com)

email_name_part

Inserts just the identifier of the user's email address (e.g. user@example.com)

external_id

Inserts the user's external ID from Active Directory

Note: this refers to the External ID field below the user's OneLogin ID, not the External ID column in the Directory Details table.

External ID field for attribute macrosGreen check marking the correct field
External ID field for directories Red X marking the wrong field

firstinitial

Inserts the first initial of the user's first name

firstname

Inserts the user's first name

generate_uuid

Generates a universally unique identifier (UUID) for the user

lastinitial

Inserts the first initial of the user's last name

lastname

Inserts the user's last name

manage_subscription_url

Inserts an admin link where the account subscription can be modified

 

manager_distinguished_name

Inserts the user manager's Distinguished Name (for use with ADP and LDAP)

 

manager_email

Inserts the user manager's email address

 

manager_firstname

Inserts the user manager's first name

 

manager_lastname

Inserts the user manager's last name

 

manager_name

Inserts the user manager's full name

 

manager_samaccountname

Inserts the user manager's sAMAccount name

 

manager_username

Inserts the user manager's username

 

manager_userprincipalname

Inserts the user manager's Userprincipalname from Active Directory

 

mapping_name

Inserts the name of the relevant mapping

 

member_of

Inserts the user's member_of attribute from Active Directory

name

Inserts the user's full first and last name

onelogin_id

Inserts the user's OneLogin ID. This is primarily intended for mapping to a custom field and provisioning a unix ID to Active Directory.

openid_name

Inserts the user's OpenID name

otp_code

Inserts a one-time passcode for the user to enter

 

password_url

Inserts a link where the user's password can be set or reset

phone

Inserts the user's phone number

 

policy_name

Inserts the name of the relevant security policy

 

policy_type

Indicates whether the policy is a user policy or app policy

 

proxy_agent_name

Inserts the name of the relevant proxy agent

 

radius_config_name

Inserts the name of the relevant RADIUS configuration

 

role_name

Inserts the name of the relevant role

 

samaccountname

Inserts the user's sAMAccount name from Active Directory

strongpwd

Randomly generates a strong password to suggest

subscription.users

Inserts the total number of user licenses allowed by your current subscription

 

title

Inserts the user's title

trusted_idp_name

Inserts the name of the relevant trusted identity provider (TIdP)

 

user.account_url

Inserts a link to the user's OneLogin account

 

user.custom_attribute_shortname

Inserts the content of any custom field you have configured

 

user.edit_url

Inserts an admin link where the user's record in OneLogin can be managed

 

user.email

Inserts the user's email address

 

user.firstname

Inserts the user's first name

 

user.group.admin.email

Inserts the email address for the administrator of the user's assigned group

 

user.group.admin.name

Inserts the name of the user's group administrator

 

user.group.name

Inserts the name of the user's assigned group

 

user.lastname

Inserts the user's last name

 

user.name

Inserts the user's full first and last name

Not to be confused with username, which inserts the user account's username in OneLogin

 

user.password_url

Inserts a link where the user's password can be set or reset

 

user.role_names

Inserts the user's assigned role(s)

 

username

Inserts the user's username in OneLogin

Not to be confused with user.name, which inserts the user's full first and last name

userprincipalname

Inserts the user's Userprincipalname from Active Directory


Expand/Collapse Comments
:     
Was this helpful?
YesYesNoNo