Macros

    Macros are special strings whose values are replaced with another string according to the function of that macro. ADManager Plus supports different types of macros that parses dynamic values whenever they are used in execution.

    For example: In the macro %sAMAccountName%, the input values would be the SAM account name of the objects on which the macro is executed.

    Macro syntax

    While using macros in ADManager Plus, it's essential to follow the syntax as outlined below. According to the category or type of the macro, the prefix will vary.

    • %<prefix>.<macroname>%
    • %<prefix>.<macroname>(Arg1, Arg2, ...)%
    • %<prefix>.<macroname>(#%<prefix>.<macroname>%#, Arg2, ...)%

    Different types of macros in ADManager Plus

    Type of macro Prefix Available macros
    Action details act
    Environment variable env Configured under the Environment Variable tab.
    Custom functions fx
    Utility -
    AD attributes ad
    • Active Directory -The configured custom attributes will be available as macros
    Microsoft 365 attributes m365

    How can you use macros in ADManager Plus?

    Click the macro selector icon-percentage icon in the modules listed below that support macros, and configure them as needed.

    • Inbound webhooks
    • Outbound webhooks
    • Webhook templates
    • Attribute mapping formats
    • Custom script configuration
    • Need to confirm notification template

    Important:

    While using macros in ADManager Plus it is recommended to follow the tips mentioned below.

    • Macros are case-sensitive. Ensure that you use the correct word casing for macros while adding them to headers, parameters, etc.
    • If a macro does not receive a valid string value during parsing, it will be replaced with an empty string.
    • Macros must start and end with the % symbol.
    • When macros are added without a prefix, they are parsed through the hierarchy of environment variables first, followed by AD attributes.
    • In nested macros, the inner macro has to be enclosed with the # symbol. For example: %func.findAndReplace("#%ad.OU_DN_NAME%#","test.com","test123.com")%

    Nested macros

    Nested macros in ADManager Plus allows for a macro to be embedded or called inside another macro. You can use nested macros by enclosing the inner macro with #. The environment variable, find and replace macros, encode and decode URI component macros are examples of nested macros.

    Example:

    • %func.findAndReplace("#%ad.OU_DN_NAME%#","<find value>","<replace value>")%

    Active Directory macros

    Active Directory (AD) attribute macros allows you to get the LDAP values of user and group objects on which the macro is being executed dynamically. By default, twenty AD attributes are available as macros in ADManager Plus. If you want to add custom attributes, configure that under Admin > LDAP Attributes. While adding custom attributes, make sure they are associated with the relevant report category.

    Microsoft 365 macros

    These macros allow you to get the Microsoft 365 attribute values of user and group objects on which the macro is being executed dynamically. By default, 18 Microsoft 365 attributes are available as macros in ADManager Plus.

    Action Details

    Timestamp macro

    Timestamp macros are placeholders or variables used to represent specific date and time values dynamically. To use this macro, select the Timestamp macro under Action Details and specify the date and time format for the values to be updated in real time whenever the macro is used.

    For example,

    When automating user onboarding tasks, you can set the start date for user account creation to be two days after the automation configuration by using the timestamp macro as shown below.

    Syntax:

    %act.timestamp_<dateformat>_<timeinterval type>_<timeinterval value>%

    Example:

    %act.timestamp_ dd-MM-yyyy _after n days_2%

    Input value Output value
    If the current date during macro parsing is: 01-01-2025 03-01-2025

    Environment variable

    An environment variable is a name or value pair that can be used as macros for values that rarely change, like Authtoken, IDs, etc. They can be used in the place of URL, Header, Parameter, and Message Body while creating a new webhook template.

    Syntax

    %env.<Variable name>%

    Example

    %env.securedToken%

    Input value Output value
    %env.securedToken% sd#123#78sd

    Custom functions

    Create custom functions whose value is retrieved from a script. The resulting value from the script execution while the variable macro is parsed will be used as the value of the custom function.

    Note: You can also store the sensitive information in the script output's arguments and add that as a nested macro in the environment variable.

    Syntax

    %fx.<Variable name>_<Argument 1>_...<Argument n>%

    Example

    %env.generateSecuredToken_#%act.timestamp_dd-MM-yyyy_current time%#_%admin%

    Input value Output value
    %env.generateSecuredToken_#%act.timestamp_dd-MM-yyyy_current time%#_%admin% The generateSecuredToken script path will be added here.

    The execution time will follow the dd-MM-yyyy format (e.g., 01-01-2024) as the first argument, with admin as the second argument.

    Both values will be parsed in the script, and the script's output will become the macro's value.

    Find and replace

    Find and replace macro helps you search and find a specific part of the source string and replace it with another string. In ADManager Plus, you can find and replace source strings and macros. To use this, in the Select Macros pop-up window, go to Functions > Find and Replace.

    Syntax

    %func.findAndReplace("#%ad.OU_DN_NAME%#","<find value>","<replace value>")%

    Example

    %func.findAndReplace("#%ad.OU_DN_NAME%#","test","prod")%

    Input value Output value
    If a user OU's, DistinguishedName = "OU=IAM users,DC=test,DC=com".

    "OU=IAM users,DC=prod,DC=com"

    Encode URI

    The Encode URI macro works similar to the actual Javascript encodeURI component. By default, the API URL and parameters of webhook templates will be encoded before execution. Apart from these, if you want to encode any other values, use this option.

    Syntax:

    %func.encodeURIComponent("<value>")%

    Example:

    %func.encodeURIComponent("Ad secure pwd")%

    Input value Output value
    L*urO@82# L*urO%4082#%0A

    Note: You can also store the sensitive information in an environment variable and add that as a nested macro in the Encode URI macro.

    Decode URI

    The Decode URI macro works similar to the actual Javascript decodeURI component. If you want to decode the encoded attribute values fetched from the integrated application, then enter the value in the Decode URI Component field.

    Input value Output value
    Ad%20secure%20pwd Ad secure pwd

    Retrieve Regex Matches

    This macro in the inbound webhook enables you to search and locate the desired pattern values from the configured endpoint's attribute columns. In the Retrieve Regex Match field (Select Macros > Utility), provide the column name and the pattern to search and match. Once done, click Add.

    This way, when data is fetched from the endpoint, it will include only the string pattern required for API processing and discard the rest in the attribute value.

    Note: The Retrieve Regex Matches macro can only be used in naming formats.

    Utility

    Attach

    If you want to use two macros consecutively, use the :ATTACH: string in between them while fetching the data from the endpoints.

    Syntax:

    %<prefix>.<macroname>%:ATTACH:%<prefix>.<macroname>%

    Example:

    %ad.givenName%:ATTACH:%ad.department%

    Input value Output value
    If the user's given name is test and the department name is accounts. testaccount

    Don't see what you're looking for?

    •  

      Visit our community

      Post your questions in the forum.

       
    •  

      Request additional resources

      Send us your requirements.

       
    •  

      Need implementation assistance?

      Try OnboardPro