Rules
Pimics Rules are an engine that lets you define transformations of data from features into other entities. Rules are not processed immediately after a change, but in 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 the 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) 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 that have Number in the range INT100029..INT100030. |
Actions
| Type | Description | Parameters Example |
|---|---|---|
| Convert Units | Uses settings in Unit Conversion to convert a value from the source feature into another feature. | ToFeaturesID: INT100032 |
| Update Field | Copies a feature value to the selected field on Items, Categories, or Documents. | Type: Item, Field No.: 2, Skip Validation: No => updates the Description field when a value is defined on the item's feature |
| Rename | Replaces the selected field value with the Condition Value field. | Type: Item, Field No.: 1 => updates the Item No. with the feature value |
| Assign Document | Assigns a document to an entity. | Type: Item Group, Search in field: Code => assigns the document to the Item Group based on Code |
| Math Operation | Executes the selected math operation on values from the condition, or on selected values. | Operation: Addition, Values from Condition: blank => sums numerical values from conditions |
| Write to Feature | Writes the result of previous actions to the selected feature. | Value: INT00001 => writes the result of the previous action to the value of feature INT00001 |
Run rules
The typical scenario is to run rules periodically in the background. It is also possible to run them manually from Product Features.
Important
The Assign Document rule must be run on features assigned to documents.
Run rules on background
Rules are processed by Job Queues, so you can run them every minute, every hour, or on your own schedule. The job (codeunit 70113878 "PIMX Rule Job") checks the modification timestamp, and if there has been 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.
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.