Written by

J2 Interactive
Question Robert Hanna · Oct 23, 2017

Routing Rule Condition based on RecordMap property

I am currently trying to add a condition to a routing rule that uses the %Source property of a routing rule.  Unfortunately I am getting compile errors when I use the "%", and if I get PROPERTY DOES NOT EXIST if I try and use any of field. I have tried referencing the messages as "Message." , "Record.",  "FullRecordMapClassName." , "Document." . Does anyone know how to reference the properties of a record map in a routing rule, or if it is even possible? Thanks!

Comments

Thembelani Mlalazi · Oct 24, 2017

yes it possible within your rule select the rule's constraint where you reference the source where the message is coming from and then click rule and  add when  on the condition for when select document . which will allow you to use the record mapper property

0
David Foard  Jan 12, 2018 to Thembelani Mlalazi

I have tried this and it does not work. I have tried all variations: document.%Source, %Source, Document.%Source and they all fail - either at compile time or at run time.

Does anyone have an explicit example that shows what the rule will look like?

0
Thembelani Mlalazi  Jan 15, 2018 to Jeffrey Drumm

@Jeffrey.Drumn Assuming I got this right He is trying to get to reference a property from a record mapper that will work just fine here is an example

TestEnvironment.Record being my record mapper class and the Document.wardAge being my property (WARDAGE)

0
Jeffrey Drumm  Jan 18, 2018 to Barry Veach

Barry, Source is the string value from the message header's SourceConfigName property, and source.%Source is an error:

0
Thembelani Mlalazi  Jan 15, 2018 to David Foard

@David Foard In  your Rule on the when  condition select the  (Document.RecordMapper.Property) make show you are referencing a record mapper on the constraint of the rule

0
Jeffrey Drumm  Jan 15, 2018 to Thembelani Mlalazi

@Thembelani, the %Source element is not directly accessible, even with the constraint set. That's why I provided the solution below.

0
Jeffrey Drumm  Jan 15, 2018 to Thembelani Mlalazi

@Thembelani Mlalazi, he's specifically looking to get at the element %Source, which is not a field defined by the user in the RecordMap, and is not visible to the Context of the Rule.

0
Jeffrey Drumm · Jan 13, 2018

Here's a potential solution. It's a method that will extract the %Source value from the message, and it should work for any Ensemble message type:

ClassUser.Util.MsgBodyExtendsEns.Rule.FunctionSet

{

 

ClassMethodGetMsgSource(pMsgAsEns.Request)As%String

 {

       ReturnpMsg.%Source

 }

 

}

Since it extends Ens.Rule.FunctionSet, it's available as a function in the rule editor:

0
David Foard · Jan 24, 2018

Out of the box there is no way to reference the %Source value of the recordmap via the UI. You will need to create a custom class as shown in previous replies/answers on this thread.

It is interesting though that if I modify the .int file directly with pContext.Document.%Source and compile, the code compiles AND the rule works.

So this must be a defect in IS code.

Also, it is disappointing that the documentation around RecordMapper usage is so poor that you need to go on this long debug sessions to figure out how things really work.

0