Written by

Question Ewan Whyte · May 8, 2025

Using assign in a routing rule using XML

I'm trying to use the assign option within a ruleset. I can trace the value with no issues but when I try to assign the same value to a variable of Namespace I get an error.
Ideally I would like to use a variable instead of repeating the Piece repeatedly throughout the rules.
Ruleset


And this is the error that I am getting.
ERROR <Ens>ErrException: <PROPERTY DOES NOT EXIST>zevaluateRuleDefinition+14^SFT.RoutingRules.AlertManCreationRule.1 *Namespace,Ens.Alerting.Context.CreateAlert -- logged as '-' number - @' set pContext.Namespace=##class(Ens.Rule.FunctionSet).Piece((pContext.AlertRequest.SourceConfigName),("|"))'
Can someone advise on where and how I can add that Namespace property so that I can assign it a value? Or have I got the wrong idea of the use of assign.
Thank you.

Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2022.1.2 (Build 574U) Fri Jan 13 2023 15:00:26 EST

Comments

Laura Blázquez García · May 8, 2025

That property doesn't exists in the class you are using as context. But in the rule editor, General tab, you have a section called Temporary Variables, you can create there, and reference it with @<name> in the rule. In your case, your assing will be:

assing @Namespace = Piece(AlertRequest.SourceConfigName,"|")

Here is the documentation:

Temporary Variables

User-specified temporary variables, which you can use in the rule definition. The variables must be separated by commas, for example:

FreeShippingValue,ShipMethod,PremierMember

You can reference a temporary variable in a rule definition by preceding the variable name with the @ (at sign) character, for example, @FreeShippingValue. You cannot use temporary variables outside the rule definition. To pass information to a transformation, you can instead use the RuleUserData property. For more information, see Selecting the Transformation and Target of a Send Action.

0
Ewan Whyte  May 9, 2025 to Laura Blázquez García

Thank you Laura, I had never used those before but it worked perfectly for what I needed.

0
Enrico Parisi · May 8, 2025

You cannot assign to arbitrary variable in rules.  (edited, in fact, you can see other posts! 🙂)

To store some temporary data you can assign it to aux.RuleActionUserData

0
Robert Hurst · May 8, 2025

Assign values to properties in the business process execution context. Someone will correct me if I am mistaken, but you need to also add that variable in the Rules General tab under Temporary Variables.

0