Using the Context Object in a UDF

  • Updated

The Context object within a UDF encapsulates specific aspects of the Rule Execution request including the following:

  • RuleApplication - the current executing rule
  • RuleSet - current executing RuleSet
  • RuleElement - current executing RuleElement. The element returned will sometimes be a rule or an action such as FireNotification or SetValue depending on where it is called.
  • Entity - current executing Entity
  • Calc - current executing Calculation. This will be null is the UDF is called by a RuleElement. If the UDF is called from a calculation, RuleElement and RuleSet will be null.
  • ContextProperties - a dictionary that is persisted for the lifetime of the rule execution request where rules can get or set values not bound to the rule application schema.

Many of the elements mentioned above also provide access to their corresponding design-time definitions ("defs") and metadata. For example, Context.RuleSet.RuleSetDef provides access to the definition of the RuleSet.

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.