{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":37796,"path":"order-management/quote-tm-create-rule.md","title":"Create a transaction rule","bundle":null,"doc_type":null,"release":"australia","body":"\n# Create a transaction rule\n\nCreate a rule in ServiceNow Quote Experience to define conditions and actions that control field behavior and layout presentation on a quote in CPQ.\n\n## Before you begin\n\nThe fields to use in rule conditions and actions must exist before creating the rule. For more information, see [Create a transaction field](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/quote-tm-create-field.md).\n\nRole required: admin\n\n## About this task\n\nRules are created through the ServiceNow Quote Experience administration interface and consist of a level, conditions, and one or more actions. The rule editor opens after the initial save — the name, description, and active state are all editable there. For full descriptions of each action type and its parameters, see [Quote transaction rules and rule groupings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/quote-tm-rules-and-rule-groups.md).\n\n## Procedure\n\n1.  Create the rule\n2.  Navigate to **All** &gt; **CPQ Administration** &gt; **Transaction** &gt; **Related Rules**.\n\n3.  Select **+ New Rule**.\n\n4.  In the **New Rule** window, enter the rule name and verify the variable name.\n\n    The variable name is set in camel case from the name you enter. To use a custom variable name, select the pencil icon to the right of the **Variable Name** field.\n\n5.  Select the rule level.\n\n    -   Select **Transaction** to create a rule that uses transaction-level fields in both conditions and actions.\n    -   Select **Transaction Line** to create a rule that can use transaction-level and line-level fields in conditions but only line-level fields in actions.\n6.  Select **Save**.\n\n    The rule editor opens. The **Name**, **Description**, and **Active** toggle are available at the top of the page.\n\n7.  Enter a description of the rule in the **Description** field.\n\n8.  Define the conditions\n9.  In the **Take Action When** menu, select the condition logic method.\n\n    |Option|Behavior|\n    |------|--------|\n    |**Always True**|Rule executes every time a user makes a change to the quote interface. No conditions to define.|\n    |**Any Conditions are Met**|Rule executes if any one condition is TRUE \\(OR logic\\).|\n    |**All Conditions are Met**|Rule executes only when all conditions are TRUE \\(AND logic\\).|\n    |**Custom Logic**|Enables parentheses and mixed AND/OR logic — for example, `Cond_1 AND (Cond_2 OR Cond_3)`.|\n    |**Advanced Function**|Enables a script that returns TRUE or FALSE to control rule execution.|\n\n10. If using a condition-based logic method, select **+ Add Condition** and define each condition.\n\n    For each condition, use the field menu to select the ServiceNow Quote Experience field to test, choose the operator, then set the test value. Repeat for each additional condition.\n\n11. Add a hiding action\n12. In the **Actions** area, select **Hiding**.\n\n13. In the field search box, search for and select the field to hide on the quote layout.\n\n14. Add a message action\n15. In the **Actions** area, select **Message**.\n\n16. In the **I want to display** menu, select the message type.\n\n    -   Select **Info** for a circular blue icon and blue text.\n    -   Select **Warning** for a triangular yellow icon and yellow text.\n    -   Select **Error** for a triangular red icon and red text.\n    -   Select **Custom** for a configurable icon and text color.\n17. In the **Show the message on** field, specify where the message appears on the quote layout.\n\n    Messages can be attached to a field, or to a layout component such as a tier or a columnset.\n\n18. In the **Message Content** field, enter the text of the message to display.\n\n    Enable the **Advanced** toggle to write a script that builds the message content dynamically.\n\n19. In the **When Message is Displayed** field, set whether the transaction can be saved when the message is visible.\n\n20. Add an exclusion or inclusion action\n21. In the **Actions** area, select **Exclusion** or **Inclusion**.\n\n22. In the **For this Field** menu, select the picklist field whose options to exclude or include.\n\n23. In the **I want to exclude/include these options** menu, select the picklist options one at a time.\n\n    Enable the **Advanced** toggle to use a script to determine which options are excluded or included.\n\n24. In the **For excluded options** menu, choose how excluded options appear to the user.\n\n    -   Select **Hide them** to remove excluded options from the menu.\n    -   Select **Disable them** to retain excluded options in the menu in a disabled state.\n25. In the **If any are already selected** menu, choose what happens when an excluded option is already selected by the user.\n\n    -   Select **Leave unchanged** to keep the excluded item as the selected value.\n    -   Select **Deselect them** to clear the selection and require the user to choose another option.\n    -   Select **Select the first valid option instead** to clear the selection and replace it with the first available option after the rule executes.\n26. Add a determination action\n27. In the **Actions** area, select **Determination**.\n\n28. In the **For this Field** menu, search for and select the field for the rule to act on.\n\n29. Under **I want to…**, select whether to set or clear the field value, and whether to allow or prevent the user from editing the field after the rule modifies it.\n\n30. In the **If user has modified values** menu, choose whether to retain the value the user entered or override it with the rule's value.\n\n    When user values are retained, use the **When user values are retained** menu to optionally show the user a recommendation message about the field value.\n\n31. In the **Use this value** field, define the value to assign.\n\n    Enable the **Advanced** toggle to enter a script — including aggregate functions — to calculate the value. For aggregate function syntax and examples, see [Quote transaction rules and rule groupings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/quote-tm-rules-and-rule-groups.md).\n\n32. Add additional actions and save\n33. To add another action of any type to this rule, return to the **Actions** area and repeat the steps for the relevant action type above.\n\n    A single rule can contain multiple actions of different types.\n\n34. Verify that the **Active** toggle is enabled, then select **Save**.\n\n    The rule is saved and appears in the Related Rules list. It is available to add to a rule grouping.\n\n\n## What to do next\n\nAdd the rule to a rule grouping so that it can be assigned to stages and events. For more information, see [Create a transaction rule grouping](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/quote-tm-create-rule-grouping.md).\n\n**Parent Topic:**[Quote transaction rules and rule groupings](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/quote-tm-rules-and-rule-groups.md)\n\n"}}