Kentico CMS 7.0 Context Help

General tab

General tab

Previous topic Next topic Mail us feedback on this topic!  

General tab

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

When creating a new macro rule or editing an existing one, you can specify the following options:



Display name

Sets the name of the macro rule displayed to users. Because this name is shown in the list of available macro rules in the Rule designer, it should also serve as a basic description.


Sets the name used as an identifier for the rule (for example in the API).


May be used to enter a description for the rule. This text is displayed to users as a tooltip in the rule designer when they hover over the rule in the list of available options.

Rule data

User text

Defines the text clause displayed in macro conditions when the rule is inserted through the rule designer.


If the rule provides parameters that modify the resulting condition, you can add them into the text by entering the Column name of a specific parameter enclosed in curly brackets, e.g. {days}. The parameter will be underlined in the text and users will be able to set its value by clicking on it in the rule designer.


Parameters can be defined by editing the rule on the Parameters tab.


Specifies the actual condition represented by the rule. The condition needs to be defined through standard context macro code (K#). Autocompletion support is provided when writing in this field.


Any parameters offered by the rule should be added to the appropriate position in the code using the same syntax as for the User text field, e.g. {days}. When the condition is being resolved, the parameter expressions will be replaced by the values specified by users in the rule designer.

Requires context

Enable this property if the rule's condition needs to access context data (information about the current user, the currently viewed page etc.) in order to work correctly. This ensures that the rule will only be offered for conditions that have the context available when they are resolved.


For example, the context is accessible when evaluating the conditions of Content personalization variants on the website's page, but not when the system is building dynamic Contact groups.





Automatic rule parameters


There are several predefined parameters that may be used to add commonly required functionality to macro rules:


{_is}, {_has}, {was}, {_will}, {_perfectum} - these provide an easy way to negate a rule's condition. Several variants with different wording are available, so you can use the one that matches the text of the particular rule. They allow users to choose between a positive and negative option, e.g. is or is not. If the negative option is selected, the parameter is resolved into the K# negation operator "!" in the condition code. With the positive option, it returns an empty string.

{_any} - useful for rules where a list of items needs to be specified through another parameter. It allows users to switch between two options that determine how the item list will be processed — any (at least one of the items must meet the given condition) or all (the condition must be fulfilled for all items in the list). When resolved, the parameter returns either a false (any) or true (all) value. In the condition code, the parameter can be inserted as an additional argument of macro methods that work with object lists, which automatically ensures the required functionality. For example: CurrentUser.IsInRole("{roles}", {_any})


When one of these parameters is entered into the User text field of a rule and saved, the corresponding definition with the appropriate form control and default values is automatically created on the Parameters tab of the given rule.


To learn more about macro rules and conditions, please see Developer's Guide -> Development -> Macro expressions -> Macro conditions.