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!

  • 0
  • 129
  • 8
  • 2

Answers

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:

Class User.Util.MsgBody Extends Ens.Rule.FunctionSet

{

 

ClassMethod GetMsgSource(pMsg As Ens.Request) As %String

 {

       Return pMsg.%Source

 }

 

}

 

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

@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)

@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.

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

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?

@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

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

Comments

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

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.