---
title: Macro resolvers
related:
  - https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/macro-syntax.md
  - https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/define-macro-fields.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Macro resolution within Xperience is handled by system components known as macro resolvers. A resolver is responsible for processing entered macro expressions and outputting the result. The resolution process can be simplified into the following steps:

1. The resolver parses the macro expression to identify its components ([macro fields](https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/macro-syntax.md#macrosyntax-macrofield), [macro methods](https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/macro-syntax.md#macrosyntax-macromethod), declared variables, control statements).
2. For each identified macro field or method, the resolver runs the code [registered with the component](https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/define-macro-fields.md). Results are substituted into the main expression.
3. The resolver then evaluates the main expression and outputs the result.

The system contains multiple macro resolvers, each responsible for a particular feature set. This separation ensures that a resolver supports only macros relevant to the feature for which it is responsible. The set of supported macro fields and methods is "taught" to each resolver on application startup.

Some macro resolvers are open to customization. Developers can "teach" a resolver additional [macro fields](https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/define-macro-fields.md) by registering them via specific classes. See the following reference for the extension points of individual resolvers.

## Resolver reference

### UI forms macro resolver

**Extension point:**  `UIFormMacroSourceRegister` – see [Define macro fields](https://docs.kentico.com/documentation/developers-and-admins/configuration/macro-expressions/define-macro-fields.md) to learn how to register additional macro fields into the resolver.

This resolver is available when defining fields for [UI forms](https://docs.kentico.com/documentation/developers-and-admins/customization/object-types.md) in the **Modules** application. Navigate to the **Modules** application → _select a module_ → **Classes** → _select a class_ → **UI forms**.

**Handles macro resolution in the following field properties:**

- Default value

The following macro expressions are available by default:

| Macro fields       | Return type | Parameters                         | Example                                                 | Description                                                                                                                                                                                                                         |
| ------------------ | ----------- | ---------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Now                | DateTime    | -                                  | `{% Now %}`                                             | Returns a `DateTime` string with the current server time.                                                                                                                                                                           |
| UtcNow             | DateTime    | -                                  | `{% UtcNow %}`                                          | Returns a `DateTime` string with the current UTC time.                                                                                                                                                                              |
| Today              | DateTime    | -                                  | `{% Today %}`                                           | Returns a `DateTime` string set to today's date, with the time component set to 00:00:00 (with formatting dependent on the application's UI culture).                                                                               |
| Macro methods      |             |                                    |                                                         |                                                                                                                                                                                                                                     |
| IsNullOrWhiteSpace | bool        | string to test                     | `{% "mystringexpressionresult".IsNullOrWhiteSpace() %}` | Tests whether the given string is null or contains only whitespace.                                                                                                                                                                 |
| IsNullOrEmpty      | bool        | string to test                     | `{% "mystringexpressionresult".IsNullOrEmpty() %}`      | Tests whether the given string is null or empty.                                                                                                                                                                                    |
| FormatString       | string      | format string<br>formatting params | `{% "It is now {0}".FormatString(Now) %}`               | Replaces all formatting expressions in a string using the text equivalents specified in the second parameter.<br>Based on [composite formatting](https://docs.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting). |
