You create user macros in the
To create a user macro:
Customization > General> Macros section, click New. The New Macro window opens.
Specify the macro name in the Name field and review the auto-generated value in the Placeholder field. The placeholder is used to identify the macro in the Select Placeholder window.
Optional: Specify a description for the macro in the Description field.
Next to Type, select the macro type:
TIP: To base a new macro on an existing one, select the source macro and click Copy Item.
Text - this macro is a combination of static text and placeholders for dynamic content (object fields and other macros).
SQL Script - this macro is a SQL script containing Transact-SQL statements.
If you plan to use the macro in e-mail notifications:
Next to Output, select the format of the macro output:
Plain Text - sets the plain text format for the macro output. Plain text messages are supported by all e-mail clients; however, you will not be able to use text formatting, bullet lists, alignment, horizontal lines, images, etc.
HTML - sets the HTML output format for the macro output. Select this format when you want to use text formatting, bullet lists, lines, images, etc. in your macro content. However, some e-mail clients may not support HTML e-mail.
NOTE: Appearance of E-mail Notifications in HTML format is controlled by standard cascading style sheet (CSS) rules. For details, see Customizing E-mail Notification styles.
Under This macro available for, define the context for the macro:
All objects - makes the macro global.
This object only - makes the macro available only for the specified object class. There are two generic classes available: "All Tickets" and "All CIs".
Enter the macro content:
For Text macro: Type in the text that will be inserted at runtime. In HTML output format, you can use a standard HTML e-mail editor for text formatting, numbering, bullets, alignment, horizontal lines, images, etc. Alternatively, you can click Design > HTML Code and directly edit the HTML code.
For SQL Script macro: Create the SQL script containing Transact-SQL statements. When executed, the script will query the database and return the value of the first column from the first row of the last SELECT statement. In HTML output format, you can use HTML tags for text formatting, tables, lists, etc.
NOTE: Creating SQL Script macros requires a good knowledge of Transact-SQL. For Microsoft SQL Server, see the Transact-SQL Reference at https://docs.microsoft.com/en-us/sql/t-sql/language-reference?view=sql-server-2017.
If you are using a different version of Microsoft SQL Server, see the relevant resource at Microsoft TechNet.
To insert a placeholder for dynamic content (object field or another macro) in your macro text or script, click the location where you want to insert it, click Insert Placeholder, and select the placeholder in the Select Placeholder window.
TIP: You can modify user macros on the fly when configuring a workflow item/component or modifying Templates for Self Service Portal notifications. To open the Macro window, right-click the selected placeholder and choose Placeholder Definition.
TIP: E-mail Notifications and Message Box operations allow you to save message text as a macro, so you can create user macros on the fly based on the text you've entered.