Rule Condition Type
Interface: interface "PIMX Rule Condition Type c1"
Enum: enum 70113796 "PIMX Pimcs Rule Condition Type"
When to use
Use this interface when you need to add a condition to the Features rule engine that evaluates the source and master records in a specific context. The condition type is selected in a rule definition and receives rule data so that custom implementations can evaluate values using the current processing context.
Use the interface
Implement the interface in a codeunit and register it in PIMX Pimcs Rule Condition Type. Use the parameter methods to define and validate configuration values. Keep IsValid side-effect free: it should evaluate SourceRec and MasterRec in the supplied context and return only whether the condition is met.
Extend enum PIMX Pimcs Rule Condition Type to register the implementation.
codeunit 50000 "Custom Rule Condition" implements "PIMX Rule Condition Type c1"
{
procedure CreateParameters(TableNumber: Integer; var Parameters: Dictionary of [Text, Text])
begin
Parameters.Add('Value', '');
end;
procedure ValidateParameterValue(Name: Text; Value: Text)
begin
if Value = '' then
Error('The %1 parameter cannot be empty.', Name);
end;
procedure LookupParameterValue(Parameter: Record "PIMX Rule Parameters"; var DefaultValue: Text)
begin
// Open a lookup and assign the selected value when needed.
end;
procedure GetDescription(Parameters: Dictionary of [Text, Text]): Text
begin
exit('Custom rule condition');
end;
procedure IsValid(SourceRecord: Variant; MasterRecord: Variant; Parameters: Dictionary of [Text, Text]; Data: Codeunit "PIMX Rule Data"): Boolean
begin
// Evaluate the records and return true when the condition is met.
exit(true);
end;
}