Table of Contents

Publication Rule

Interface: interface "PIMX Publication Rule c1"
Enum: enum 70113756 "PIMX Publication Rule Type"

When to use

Use this interface when you need to add a rule that controls which records are included or processed during publication creation or reorganization. The rule is selected in publication-group configuration and can define parameters, filter retrieved data, and validate publication lines and structure.

HIDDEN

DevOps sources: #23007, #35165

Use the interface

Implement the interface in a codeunit and register it in PIMX Publication Rule Type. Use SetDataRetrievalFilter to reduce the data read before publication processing, RetrievedDataIsValid and PublicationDataIsValid for record checks, and StructureIsValid for parent and child-line decisions. Use ShowLabel to describe the configured rule to users.

Extend enum PIMX Publication Rule Type to register the implementation.

codeunit 50000 "Custom Publication Rule" implements "PIMX Publication Rule c1"
{
	procedure CreateParameters(PublicationGroup: Record "PIMX Publication Group"; var Parameters: Dictionary of [Text, Text])
	begin
		Parameters.Add('Value', '');
	end;

	procedure OnLookupValue(Parameter: Record "PIMX Publication Rule Param"; var Value: Text)
	begin
		// Open a lookup and assign the selected value when needed.
	end;

	procedure OnValidateValue(Parameter: Record "PIMX Publication Rule Param"; Value: Text): Boolean
	begin
		exit(Value <> '');
	end;

	procedure PublicationDataIsValid(Line: Record "PIMX Publication Line"; Data: Codeunit "PIMX Publication Data"; Parameters: Dictionary of [Text, Text]): Boolean
	begin
		exit(true);
	end;

	procedure ShowLabel(PublicationRule: Record "PIMX Publication Rule"; Parameters: Dictionary of [Text, Text]): Text
	begin
		exit('Custom publication rule');
	end;

	procedure SetDataRetrievalFilter(var FilterRecord: RecordRef; Data: Codeunit "PIMX Publication Data"; Parameters: Dictionary of [Text, Text])
	begin
		// Set filters before publication data is retrieved when appropriate.
	end;

	procedure RetrievedDataIsValid(RecordVariant: Variant; Data: Codeunit "PIMX Publication Data"; Parameters: Dictionary of [Text, Text]): Boolean
	begin
		exit(true);
	end;

	procedure StructureIsValid(Line: Record "PIMX Publication Line"; Data: Codeunit "PIMX Publication Data"; Parameters: Dictionary of [Text, Text]): Boolean
	begin
		exit(true);
	end;
}