Creating User Macros

You can create a user macro as follows:

  1. From the Sidebar, navigate to Workflow and Business Logic > Macros. .

  2. Click New. The New Macro dialog box opens.

  3. On the General tab, specify the macro name in the Name field and review the auto-generated value in the Placeholder field.

  4. Optional: Specify a description in the Description field.

  5. Next to Type, choose the macro type:
    • If you want to create a combination of static text and placeholders for object fields and other macros, click Text.

    • If you want to create a SQL script, click SQL Script.

  6. If you plan to use the macro in e-mail notifications, next to Output, select the format of the macro output:

    • Plain Text — This is the default format because plain text messages are supported by all e-mail clients. However, you will not be able to use text formatting.

    • HTML — Select this format when you want to use text formatting, bold or colored font, bullet lists, images, etc. in your macro content.

      NOTE: The appearance of E-mail Notifications in HTML format is controlled by standard cascading style sheet (CSS) rules. For details, see Customizing the Style of E-mail Notifications.

  7. Under This macro available for, define the context for the macro as follows:
    • If you want this macro to be available for all object classes, click All objects.

    • If you want this macro to be available for a particular object class, click Object class and select an object class from the list.

      NOTE: You can choose a generic object class: All Tickets or All CIs.

  8. Under Content, specify the macro content:
    • For Text macro: Type the text that will replace the macro’s placeholders at runtime.

      To insert a placeholder for dynamic content (object field or another macro), place the cursor in the position where you want to insert it, click Insert Placeholder, and select the placeholder.

      INFO: For details, see Inserting Placeholders.

      If you selected the HTML output format, you can use the integrated visual HTML editor for text formatting. Alternatively, you can click the Design > HTML Code and edit the source code of the macro content.

    • For SQL Script macro: Create a SQL script containing Transact-SQL statements. When executed, the script will query the database and return a single value.

      NOTE: SQL Script macros return the value of the first column from the first row of the last SELECT statement. Creating SQL scripts requires a good knowledge of Transact-SQL. For Microsoft SQL Server 2005, see the Transact-SQL Reference at
      http://technet.microsoft.com/en-us/library/ms189826%28v=sql.90%29.aspx 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) into the SQL script, place the cursor in the position where you want to insert it, click Insert Placeholder, and select the placeholder.

      INFO: For details, see Inserting Placeholders.

      If you selected the HTML output format, you can use HTML tags in your script.

  9. Click OK.

    Once you create a macro, it becomes available in the User Macros category of the Select Placeholder dialog.

    INFO: For details, see Inserting Placeholders.

    NOTE: HTML macros are available only when you configure E-mail Notifications (including Self Service Portal notifications) to use HTML format. For details, see : Creating E-mail Notifications and Modifying Templates for Self Service Portal Notifications

    NOTE: Some workflow items 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. For details, see Creating E-mail Notifications and Message Box.