Rules
Pimics Rules are an engine that allows you to define data transformations from features to other entities. Rules are not processed immediately after a change. They run in the background, so there can be a short delay.
Define rules
- Choose the Search icon, enter Rule List and then choose the related link.
- On the Rules page, choose the New action.
- Select features that will be used as a source for the rule by creating a new line in Condition.
- Set Condition Type to Feature.
- Select Product Feature, choose (
...), and then select Product Feature ID(s) to use as a rule condition. The item must contain this product feature for the rule to apply.
Available rules
After installation, there is a predefined set of conditions and actions.
Conditions
For a rule to function correctly, a condition must be defined.
| Type | Description | Parameters |
|---|---|---|
| All | Action runs for all features. | - |
| Feature | Action runs only for selected features. | Product Feature ID |
| Product Feature Filter | Filters features by a condition defined in parameters. | Table No.: 70114120, Field No.: 1001, Value: INT100029..INT100030 => action runs for all features with Number in the range INT100029..INT100030. |
Actions
| Type | Description | Parameters Example |
|---|---|---|
| Convert Units | Uses settings in Unit Conversion to convert a value from a source feature to a target feature. | ToFeaturesID: INT100032 |
| Update Field | Copies a feature value to a selected field on an Item, Category, or Document. | Type: Item, Field No.: 2, Skip Validation: No => updates field Description when a value is defined on the item feature. |
| Rename | Replaces the selected field value with the condition value. | Type: Item, Field No.: 1 => updates Item No. with the feature value. |
| Assign Document | Assigns a document to an entity. | Type: Item group, Search in field: Code => assigns a document to an item group based on code. |
| Math Operation | Executes a math operation on values from conditions, or selected values. | Operation: Addition, Values from Condition: blank => sums numeric values from conditions. |
| Write to Feature | Writes the result of previous actions to a selected feature. | Value: INT00001 => writes the result to feature INT00001. |
Run rules
The typical scenario is to run rules periodically in the background. You can also run them manually from Product Features.
Important
The Assign Document rule must run on features assigned to a document.
Note
When the Run Rules action is executed on a product feature line, the rules processed field on the product feature will always be set to Yes, even if the feature is not part of any rule.
Run rules on background
To process rules, use Job Queues so you can run them every minute, every hour, or at a custom interval. The job (codeunit 70113878, "PIMX Rule Job") checks the modification timestamp. If there is a change since the last successful run, it starts all rules for the product feature.
Setup Rule Job
Please follow Microsoft documentation Use job queues to schedule tasks.
- Search for Job Queue Entries and select the related link.
- Create a new entry
- In Object Type to Run, select Codeunit.
- In Object ID to Run, enter 70113878.
- There is no additional configuration available, so keep Parameter String empty.
- For the rest of the configuration follow Use job queues to schedule tasks.
- Finally, select Set Status to Ready.
Export rules with Configuration Package
Exporting rules should preferably be done in several steps by using three distinct configuration packages.
Configuration package 1 - Features and Units (optional)
Features used in rules must exist in the target database. They can be created manually or, for larger volumes, by using a configuration package. Create a new configuration package with these tables:
- Catalog Units (70114054)
- Features (70114063)
For the Features table, disallow these five fields:
System status Updated on
Updated by
Created on
Created by
Export the configuration package to Excel, and create an identical package in the target database. Import data from Excel, then choose Import and Apply Package.
Configuration package 2 - Rule Headers, Rule Line
Create a new configuration package containing these tables:
- PIMX Rule Header (70113754) // NOTE: in selection table the table is called PIMX Rule
- PIMX Rule Line (70113755)
Export the configuration package to Excel, and create an identical package in the target database. Import data from Excel, then choose Import and Apply Package.
Configuration package 3 - Rule Parameter
Create the last configuration package with this table:
- PIMX Rule Parameter (70113756)
Export the configuration package to Excel, and create an identical package in the target database. Import data from Excel, then choose Import and Apply Package.
Rule parameters should be in a separate package. If all three tables are imported together, the Rule Line ID needed to pair parameters with rule lines is created in a later step, so errors can occur.
If you import all three tables at once, you must apply the package twice.
Advanced Rule Management
Managing Rule Order
You can reorder rule execution sequences directly from the rule configuration pages by using the Move Up and Move Down actions. This allows you to adjust the order in which rules are processed without manually managing line numbers.
Rule Execution from External Systems
Partner extensions can invoke rule execution from external systems, enabling more flexible integrations.
Advanced Rule Condition Interface
An advanced rule condition interface is available, providing partners and developers with complete data context and platform parameters for intelligent condition implementations. See developer documentation for interface details and usage examples.
Customizations
It is possible to extend rules with custom conditions and actions.
You need to implement interfaces:
interface "PIMX Rule Condition Type"andenum 70113796 "PIMX Pimcs Rule Condition Type"interface "PIMX Rule Action Type"andenum 70113797 "PIMX Rule Action Type"
Please follow documentation and instructions available in the source code.
Related Information
See define features.