Question
· 16 hr ago

Routing Rule with a variable target

Hi all,

Recently we were experimenting with having a variable target on a routing rule and noticed some interesting behaviour, code below.

<rule name="My Rule" disabled="false">
<constraint name="docCategory" value="Generic.2.3.1"></constraint>
<when condition="((Document.{MSH:MessageType.triggerevent}=&quot;A43&quot;))">
<send transform="" target="To&quot; _(pContext.Document.GetValueAt(&quot;MSH:SendingFacility&quot;))_&quot;FromServiceTCPOpr"></send>
</when>
</rule>


This code compiles and works. If SendingFacility is "TOM" the message will rout to ToTOMFromServiceTCPOpr, and if it is "BOB" it will route to ToBOBFromServiceTCPOpr.

However - if we remove the space between the first &quot; and the first underscore as in below this rule will not compile with error

<send transform="" target="To&quot;_(pContext.Document.GetValueAt(&quot;MSH:SendingFacility&quot;))_&quot;FromServiceTCPOpr"></send>

 

Invalid target name: To"_(pContext.Document.GetValueAt("MSH:SendingFacility"))_"FromServiceTCPOpr. Target name should not contain "_ and _"

Is this an error with the compiler or an issue with the rule (or neither)?

Thanks.

Product version: IRIS 2025.2
Discussion (1)2
Log in or sign up to continue

The issue with the code arises due to the presence of invalid characters in the target name when there is no space between quotes and the underscore. According to routing rule constraints, the target name should not contain certain characters like underscores or double quotes directly next to each other. These characters are disallowed to maintain proper syntax and rule compilation behavior. It is not just a compiler error but suggests that syntax conventions prevent the format that lacks a space to ensure clarity and compliance [1][2].

Sources: