Rules
Pimics Rules are an engine that allows to define transformations of data from features into other entites. Rules are not processed immediately after the change, but on the background so there can be a small 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.
- Specify field Condition type as Feature
- Select Product Feature, click on (...) and select Product Feature ID/s to select them as a condition of the Rule. Item must contain this product feature in order for this rule to be applicable
Available rules
After installation there is a predefined set of Conditions or Actions.
Conditions
For Rule to function correctly Condition must be defined
| Type | Description | Parameters |
|---|---|---|
| All | Action will be run for all features | - |
| Feature | Action will be run only for selected Features | Product Feature ID |
| Product Feature Filter | Filter features by a condition defined in parameters | Table No.: 70114120, Field No.: 1001, Value: INT100029..INT100030 => Action will be run for all features that have Number in range INT100029..INT100030 |
Actions
| Type | Description | Parameters Example |
|---|---|---|
| Convert Units | ToFeaturesID: INT100032 =? It use settings in Unit Conversion to convert a value from source feature into feature INT100032 | |
| Update Field | Copy a value of feature to the selected field on Item, Categories, Documents | Type: Item, Field No.: 2, Skip Validation: No => will update field Description when value is defined on item's feature |
| Rename | Condition Value field will replace selected fields Value | Type: Item, Field No.: 1 => will update field Item No. with Feature Value |
| Assign Document | Will assign document to entity | Type: Item group, Search in field: Code => will assign document to Item grupe based on Code |
| Math Operation | Will execute selected Math Operation on Values from condition, or selected ones | Operation: Addition, Values from Condition: blank => Will sum Numerical Values from Conditions |
| Write to Feature | Will write resolute of previous Actions to selected Feature | Value: *INT00001 => Will write resolute of previous action into Value of Feature INT00001 |
Run rules
Typicall scenario is that we run rules periodically on background. There is also possibility to run it manually from Product Features.
Important
Assign Document rule must be run on Features assigned to 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 we use Job Queues, so you can run it every minute, hour or define your own period. Job (codeunit 70113878 "PIMX Rule Job") check the modification timestemp and if there is achnge since the last success 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 related link
- Create a new entry
- In Object Type to Run select Codeunit
- In Object ID to Run fill up 70113878
- There is no addition available configuration so keep Parameter String empty
- For the rest of the configuration follow Use job queues to schedule tasks.
- In the end select Set Status to Ready
Export rules with Configuration Package
Exporting Rules should preferably done in several steps via 3 distinct configuration packages
Configuration package 1 - Features and Units (optional)
Features used in rules must exist in target database, they can either be created manualy, or in case of larger volume of features, via configuration package. Create new Configuration Package with tables
- Catalog Units (70114054)
- Features (70114063)
For the feature table disallow 5 fields:
System status Updated on
Updated by
Created on
Created by
Export Configuration package to Excel and create identical one in Target database
Import data from excel, click Import and Apply package
Configuration package 2 - Rule Headers, Rule Line
Create new configuration package containing table:
- PIMX Rule Header (70113754) // NOTE: in selection table the table is called PIMX Rule
- PIMX Rule Line (70113755)
Export Configuration package to Excel and create identical one in Target database
Import data from excel, click Import and Apply package
Configuration package 3 - Rule Parameter
Create last configuration package with table:
- PIMX Rule Parameter (70113756)
Export Configuration package to Excel and create identical one in Target database
Import data from excel, click Import and Apply package
Rule parameters should be in separate package. In case all three tables are imported togeather, Rule line ID, that is needed to pair the parameters with rule line is created in later step, therefore errors will occure.
In situation that you do import all three tables at once, you must apply package twice.
Advanced Rule Management
Managing Rule Order
You can reorder rule execution sequences directly from the rule configuration pages using Move Up and Move Down actions. This allows you to easily 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 in 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.