Create macros for cart layout

Service catalog enables you to create macros for cart layout records using Jelly scripts to define customized behavior and display within a widget or screen.

About this task

Macros that you create do not affect upgrades because customized widget functionality is isolated from general cart behavior.

To create a new macro:

Procedure

  1. Open the relevant cart layout record.
  2. Navigate to Widget Macros or Column Macrorelated list.
  3. Click New.
  4. Enter details for the macro.
    Table 1. Macro form
    Field Description
    Name The name for the new macro.
    Active A check box to indicate whether the macro is displayed or not.
    Description A summary of how the macro is used.
    Active A check box to indicate whether the macro is displayed or not.
    XML The Jelly script to apply for your macro.
  5. Save the macro record.

Example

This example demonstrates the script to add a Requested for reference field as a widget macro to a cart layout record.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <j:set var="ref" value="sc_cart" />
    <j:set var="jvar_ref" value="${jvar_cart.getRequestedFor()}" />
    <j:set var="jvar_ref_display" value="${jvar_cart.getRequestedForDisplayName()}" />
    <tr>
        <td colspan="3">
            ${gs.getMessage('Requested for')}:
        </td>
    </tr>
    <tr>
        <td colspan="3" style="padding: 4px;">
            <g:catalog_requested_for />
        </td>
    </tr>
</j:jelly>