The EvaluateAgentryRule method can be called by the external process to request a named rule be evaluated by the Agentry Client. Included in the parameters to this method are the internal names of the module in which the rule is contained and the name of the rule to be evaluated. Also included are the AgentryContext and a string parameter in which the return value of the rule will be captured.
Rules evaluated by the EvaluateAgentryRule method are evaluated in the context of the module MainObject of the same module in which the rule is defined. Any rule in the module may be evaluated via this method, with the rule’s return value provided as a string. This value can then be converted to other data types as needed within the external process.
bool EvaluateAgentryRule(AgentryContext* pCtx, const std::tstring& ModuleName, const std::tstring& RuleName, std::tstring& Value)
- pCtx - Pointer to the AgentryContext object returned by a call made to the AgentryInitialize() method.
- ModuleName - The name of the module definition within the Agentry application project in which the rule to be evaluated is defined.
- RuleName - The name of the rule to be evaluated and whose return value is to be captured in the Value parameter.
- Value - Reference to a string value within the external process in which the return value of the rule definition will be contained. Regardless of the rule context or structure, the return value is always provided as a string value and can be cast to other data types within the external process.
The Boolean return of this method indicates whether or not the rule was found and evaluated. If this fails for any reason the function returns false and the value of the Value parameter is a null string. The return value should always be checked before attempting to use the Value parameter and the external process should include logic to account for a failed rule evaluation.