Introduction
Attribute macros are used to create custom, flexible inserts within several areas of OneLogin. These inserts will mainly relate to user attributes, but also include some OneLogin account attributes. Furthermore, you can completely customize them by using custom fields. They are used in three areas within OneLogin:
- Within Apps for configuring login parameters (e.g. placing a "test" after an email for a sandbox account)
- For mappings
- Within custom invites used in Branding your account
Macro structure and syntax
Attribute macros follow a simple syntax. Any of the mappable attributes can be used in a macro and their value is evaluated in the final attribute value.
For example, you've got a macro that looks like this:
{firstname}sometext{lastname}
{firstname} will be evaluated to the user firstname, and {lastname} to the user lastname. The sometext string remains - add any piece of text to construct the final value you want as long as they are not enclosed by '{' and '}'.
Available macro attributes
The following attributes can be part of a macro:
- {name} - User's full name
- {firstname} - User's first name
- {firstinitial} - User's first initial of their first name
- {lastname} - User's last name
- {lastinitial} - User's first initial of their last name
- {email} - User's email address
- {email_name_part} - User's email address before the @
- {email_domain_part} - User's email address after the @
- {username} - User's username
- {phone} - User's phone number
- {department} - User's department
- {title} - User's title
- {openid_name} - User's OpenID name
- {samaccountname} - User's sAMAccount name (from Active Directory)
- {member_of} - User's member of (from Active Directory)
- {external_id} - User's external id (from Active Directory)
- {userprincipalname} - User's Userprincipalname (from Active Directory)
- {strongpwd} - A randomly generated strong password
- {directory_name} - User's directory name
- {account_name} - OneLogin Account name
- {account_url} - Subdomain Login (e.g. mycompany.onelogin.com)
- {password_url} - Password Set URL, which allows a user to create a password
- {onelogin_id} - OneLogin ID (a unique integer assigned to each user by OneLogin). This is primarily intended for mapping to a custom field and provisioning a unix ID to Active Directory.
- {manager_name} - User Manager's Full Name
- {manager_firstname} - User Manager's first name
- {manager_lastname} - User Manager's last name
- {manager_email} - User Manager's email address
- {manager_username} - User Manager's username
- {manager_samaccountname} - User Manager's sAMAccount name
- {manager_userprincipalname} - User Manager's Userprincipalname
- {manager_distinguished_name} - User Manager's Distinguished name (for use with ADP and LDAP)
- {generate_uuid} - Generates a UUID for a user.
- User custom fields can also be used in a macro. The syntax is the following: {custom_attribute_<name>} where <name> is the Shortname of the custom field (i.e custom_attribute_foo}).
Use Macros to set login parameters
To set login parameters, go to Apps and select the app you want to set the parameters by selecting Edit. Go to Parameters and navigate to Default values (either Username or Name ID). You can optionally select the - Macro - option, and a text box appears on the right side of the dropdown. Enter the macro and click Update in the bottom right corner. Macros aren't available for password parameter types.
Note. You can use the Macro option to enter a hard value in the text box. This is useful when you want to pass a default parameter value for an app. For example, let's say you have a project management app that can pass the parameter Product to limit users to a particular product area, and you want to provide a default Product value when users are first provisioned to the app. Simply go to the Parameters tab for the app, click the Product parameter row, select a Value of - Macro - on the Edit Field Product dialog, and enter the default Product value in the edit field that appears.
Use macros with user mappings
To use macros with mappings go to Users > Mappings. Mappings work forwards and backwards by allowing you to map from a directory into OneLogin or from OneLogin to Active Directory (see mappings article for more details). They are added in the same fashion as the macros shown for login parameters. Using macros with custom invites
To use macros with custom invites go to Settings>Branding. Custom invites allow you to add in macros in emails that go to your new users if they have a directory password or if they need to establish a new password. They are added in the same fashion as the macros shown for login parameters. |