Business Rules adds functionality in several Microsoft Dynamics 365 for Finance and Operations modules in order to maintain a work flow status to a record. The functionality is aimed for situations where a full work flow setup would be an overkill of setup and administration efforts.
E.g., when a new item is entered in the system, commercial, technical, purchase, logistical and legal data should be specified, by various departments. These steps can be parts of a business work flow.
The basic structure of the business rules can be found in Common > Setup > Business rules.
Rules can be defined for:
The user can define the different statuses that a business rule may have. A status can be excluded from lookup (hide), e.g. if a fall back status should not be selected by the user, or if a status is set automatically during posting the order: the status Confirmation printed should not be selected manually.
Typing the status is possible though, but the feasibility of the transition to this status is checked anyway.
Common > Setup > Business rules > Business rule parameters
Field | Description | Remark |
Bundle size (events per bunde) | Number of records per thread in the batch job that updates the business rule statuses |
Integrate product life cycle state with business rules |
The product life cycle state can be set by using the business rules transitions and can be setup in the parameter of the business rule status. |
Inherit the business rule status from template for |
When new record is created from template, the business rule status will be inherited from that template record instead of the business rule begin status. Add template domain for which this logic should apply. |
The parameter "Begin status" of the concerning business rule, must be set to Yes. Otherwise this feature will not be applied and Status will be empty.Enter remark here |
Master planning > Setup > Master planning parameters
Field | Description | Remark |
Dynamic plan excludes sales orders |
Never (independent of BR status) According to BR status Use in requirements parameter |
Never: the current dynamic plan can be used for calculating possible delivery dates, even if its business rule status should ignore the order in the Master plan. According to Business Rule status: dynamic and static plans will respect the Use in requirements parameter. |
Common > Setup > Business Rules
The field (Business rule) Status is in the form Sales orders and other forms can be used to indicate the current status.
For each type of business rule, a begin status can be defined.
The user can define the feasible transitions from one business rule status to another. Each transition may be limited to users authorized for a chosen security key. The field Role AOT name determines whether the user is allowed to go to the “To-status”.
When the field is changed, the transition validation is executed. Conditions may be defined for each transition. A couple of standard validations exist for sales orders and purchase orders. A status line with a "paper clip" icon indicates that an expression validation is defined for this transition, a "tag" icon indicates a xpp validation.
Beside these two options, conditions also may be set using the default Microsoft Advanced query functionality.
Validation is described in more detail in a later paragraph.
If the validation check would fail, the transition fails. It is possible to define a fallback status for this situation.
Per transition it's possible to determine whether a business event needs to be generated.
When a transition condition for an XPP method has been extended with parameters, old records give an error as there are no parameters. This refers to the option we added to exclude cancelled lines in the Check zero sales price condition for sales orders.
Users can run into an error after installing a new version with extra parameters. This error is because of the existing records do not have the new parameters.
This can be solved manually by opening the XPP method form and clicking OK, but there is also added an upgrade script: If the button "Initialize transition condition parameters" is clicked, all parameters will be initiated. THis will prevent the error in future for the actual parameters. The user will get a message that the parameters are updated.
Common > Setup > Business rules > Button: Parameters
Additional parameters can be set per business rules status type, except for Opportunities.
Note
The parameters depends on the type of the business rule:
Field | Description | Remark |
Quotation status | When the quotation is promoted to this quotation status, the current business rule status can be applied automatically to this quotation. | Example: if the quotation is sent to the prospect or customer, the quotation status gets updated, and the business rule status can be updated automatically too. |
Quotation |
Posting quotation allowed when quotation has this business rule status? |
Confirmation |
Posting confirmation allowed when quotation has this business rule status? |
Field | Description | Remark |
Document status | As soon as the confirmation or packing slip etc. is posted, the order will automatically be promoted to this business rule status. | Example: if the confirmation is posted, the business rule status will automatically set to the business rule with this document status. |
Use in requirements |
If unchecked, this sales order will be ignored by classic Master planning |
Exclude from master planning |
Adjust the Exclude form master planning checkbox on the sales order. |
Default will keep it as it is. No disables the checkbox. Yes enables the checkbox. |
Exclude from external inventory planning |
Skip export to external planning software e.g. Slim4 Integration |
Only if Slim4 Integration connector is installed |
Confirmation |
Can the sales order confirmation be posted when the order is in this business rule status? |
|
Release to warehouse |
Release to warehouse allowed (WHS) when the order is in this business rule status? |
Warehouse management parameter "Enable blocking reasons and business rules" must be switched on. |
Picking list (WMS 1) |
Can the picking list (WMS I only) be generated when the order is in this business rule status? |
|
Packing slip |
Can the packing slip be posted from sales order when the order is in this business rule status? WHS: Post packing slip from packing station, from shipment, from load, from sales order) |
|
Invoice |
Can the sales order invoice be posted when the order is in this business rule status? |
Confirm shipment |
Can the shipment (WHS only) be confirmed (from shipment, from load, from packing station or from work) when the order is in this business rule status? |
Consider the possible disturbing and procedure if the goods are picked and packed but the warehouse employee can not confirm the shipment. Warehouse management parameter "Enable blocking reasons and business rules" must be switched on. |
Edit header |
Can the order header be edited when the order is in this business rule status? |
The modify and complete buttons of call center act on the edit header parameter. When the user is allowed to edit the sales order header, the modify button is enabled. When the order is set to completed, the order is not editable anymore. |
Can edit header if role |
A user can edit the header when this role is assigned to this user. |
|
Edit line |
Is the order line editable when the order is in this business rule status? |
This parameter controls whether the fields on the order lines are editable it could be that there are other functions that can manipulate the content of fields in the order lines are still available. |
Can edit line if role |
A user can edit the lines when this role is assigned to this user |
|
Create line |
Can a new line be added when the order is in this business rule status? |
This parameter controls the New, add lines and add products buttons, it could be that there are other functions that could create new order lines are still available. |
Delete line |
Can a line be deleted when the order is in this business rule status? |
Important
Field | Description | Remark |
Document status | As soon as the purchase order is confirmed to the vendor, or the receipt list is printed. the order will automatically be promoted to this business rule status. |
Purchase inquiry |
Can a purchase inquiry be created when the order is in this business rule status? |
Purchase order |
Can the purchase order confirmation be posted when the order is in this business rule status? |
|
Receipts list |
Can the receipts list be printed when the order is in this business rule status? |
|
Packing slip |
Can the product receipt (purchase packing slip) be posted when the order is in this business rule status? |
|
Invoice |
Can the purchase invoice be generated when the order is in this business rule status? |
|
Edit header |
Can the order header be edited when the order is in this business rule status? |
|
Can edit header if role |
A user can edit the header when this role is assigned to this user. |
Edit line |
Can the order header be edited when the order is in this business rule status? |
|
Can edit line if role |
A user can edit the lines when this role is assigned to this user. |
|
Create line |
Can a new line be added when the order is in this business rule status? |
Delete line |
Can a line be deleted when the order is in this business rule status? |
Field | Description | Remark |
Auto update | Automatic update when this customer, vendor or prospect is transferred to this status. |
Blocking reason |
New blocking reason when customer, vendor or prospect is transferred to this status. |
E.g. blank the blocking reason when customer gets status "Active". |
Field | Description | Remark |
Purchase auto-update | Auto-update the parameter Stopped for Purchase | On item level |
Auto-update Stopped with this value |
New value for Stopped |
If slider is not active, set Purchase auto-update to Yes and save the record. |
Inventory auto-update |
Auto-update the parameter Stopped for Inventory |
On item level |
Auto-update Stopped with this value |
New value for Stopped |
If slider is not active, set Inventory auto-update to Yes and save the record. |
Sales auto-update |
Auto-update the parameter Stopped for Purchase |
On item level |
Auto-update Stopped with this value |
New value for Stopped |
If slider is not active, set Sales auto-update to Yes and save the record. |
Product life cycle state auto-update |
Auto-update PLCS on the released product |
Business rules parameter "Integrate product life cycle state with business rules" must be switched on. |
State |
New value for Product life cycle state |
If field is not editable, set PLCS auto-update to Yes and save the record. It is possible to blank the state when released product is transferred to a status. |
Blocking reason auto-update |
Auto-update the blocking reason on the released product |
Blocking reason |
New value for Blocking reason |
If field is not editable, set Blocking reason auto-update to Yes and save the record. It is possible to blank the blocking reason when released product is transferred to a status. |
In the business rule for released products it is possible to specify the blocking reason or value of the Stopped check marks that are set automatically when this business rule status is reached. E.g. if the business rule status is “Wait for commercial approval”, the item should remain blocked for sales orders. As soon as the status is set to “Item released” the blocking reason or the stopped mark is blanked.
If the business rule parameter "Integrate product life cycle state" is enabled, the system checks whether there are PLCS records where the Default when released to legal entity is enabled. If true, it will give a message ‘On product life cycle state %1 the value Default when released to legal entity will be set to No as this will be set by the business rule. On our business rules of type Items it is possible to setup a blocking reason which is set when you choose this state.
Also, the user gets the possibility to setup a Product life cycle state (PLCS) on the business rule of type Items. When the business rule status is maintained on a product master, the system will set the PLCS on the product and variants same as blocking reasons. If there is begin Item status with PLCS and Blocking reason set, when product master or variant is released to a legal entity, the initial status, PLCS and Blocking reason are assigned on the master and only PLCS and Blocking reason are assigned on the variant. Business rules are only set on products, not on variants.
Also there is a periodic job ‘Change life cycle state for obsolete products’ which identifies products/ product variants that need to be updated. When updating PLCS for obsolete products, the user gets the possibility to select a business rule status. Based on the parameters setup on the selected status, the new product lifecycle state and blocking reason will be filled in the dialog. When executing this job, the business rule status, PLCS and blocking reason will be updated on the released product. Only PLCS and blocking reason will be updated on the variants. If the Blocking reason or Business rule is empty, it will not empty the fields on the obsolete product but it will keep the existing values.
When a released product has variants, the business rule status is NOT updated on the released product as this feature is only updating variants and released products without variants.
The business rule controllers can contain validation methods.
With the expression validation it is possible to define query based rules. Every business rule enabled table must have an AOT query attached to it (by code). Based on this query fields can be selected in the expression designer.
Note
E.g. If the Sales order pool must be 07, set up an Expression Where Pool equals value 07. In the Message that should be displayed if the expression fails, enter "Pool must be 07".
The following Xpp validations are shipped with the solution:
Xpp validation | Description |
Sales order and sales quotations |
checkZeroPrice | Checks whether all order lines have a line amount, if not the fall back status will be applied Exclude cancelled lines: Cancelled order lines can be ignored, for example to ignore cancelled kit-items with an exploded BOM. |
checkSalesLineMarginQuestionable | Checks whether all order lines are above the questionable margin threshold but below the acceptable threshold, if so the fall back status will be applied |
checkSalesLineMarginUnacceptable | Checks whether all order lines are below the questionable margin threshold, if so it will apply the fall back status will be applied |
Purchase order |
checkOrderTotal |
Checks whether the value of the order is below or above the order total. This check is based on the totals logic on the purcahse order:
|
With the Xpp validation it is possible to use custom code. The business rule controllers can contain validation methods. The purpose of this is to create validations that can be used in multiple checks. E.g. a predefined method checkZeroPrice as defined on the WRDBusinessRuleController_SalesTable.
Press the button Xpp. In the dialog, enter Class description = Sales orders and Method = checkZeroPrice.
Specify a message "Sales line price can not be zero.".
The message can be setup per language through the button Message text.
In the field Role AOT name, the users to whom this role is assigned, can go to the To-status, even if validation fails.
The XPP methods can be extended by a developer. Clicking on the Xpp button on the Business rule condition, will show a dialog where the users needs to select the proper class and choose a method that will validate the transition (for example checkZeroPrice).
The methods that are selected here are defined on the class selected in the first field. For sales orders this is the class named DYSBRLBusinessRuleController_SalesTable. In order to add your method, you need to write an augmentation class and augment the specific class with the new XPP method.
This method needs to have the proper profile which consists of a few conditions:
The parameter is the record for which the business rules is changed, but it should be defined as a Common record. In the method the developer can cast it to the specific table. The method should return a Boolean indicating whether the transition is valid. So true if the status can be changed and false otherwise.
An example for a new method could be checking whether the sales table has at last one sales line. The code for this would be as follow:
After compiling the code, the name of the method will show up in the method lookup and the user is able to select it.
Common > Setup > Business rules > Logbook
Logging of status changes for a certain business rule type can be setup in the Logbook form by creating a record for the business rule type and activate the logging checkbox. From that moment on status changes will be tracked and can be shown via the button “Logbook” on the business rule. It will show all the log records for transitions from OR to the selected status.
Or via the “Logbook” menu item of the applicable type, E.g Released products, ribbon tab General > Business rules > Logbook.
Field | Description |
Type | The type of table the rule applies to |
Logging | Enable logging for the table |
Log type |
Manual or All |
In case of all system triggered transitions will also be logged |
Log level | Enable logging for the table, with the options All or Errors only |
Via System administration > Setup > Business events > Business events catalog, the following business events for Business rules can be activated:
Fields passed to the event:
Field name | Label |
ReferenceKey | Reference key (id of the record) |
FromStatus | From Status |
ToStatus | To Status |
LogMessage | Log (info log of the business rule transition error) |
CreatedBy | Created By |
LegalEntity | Legal Entity |
BusinessEventId | Business Event Id |
ControlNumber | Business Event control number |
EventId | Business Event instance ID |
EventTime | Event time (Date/time) |
MajorVersion | Major Version |
MinorVersion | Minor Version |
Besides activation of the event in the catalog, also the checkbox Activate business event on the business rule transition needs to be enabled.
As there is no transition from blank to the default business rule status the system will always generate an event in that case.
All customers > Fast tab: General
This business rule can be used for a simple work flow for the creation of a customer with the relevant data. When changing the business rule status of the customer, the blocking reason can be updated automatically.
Sales and marketing > Relationships > Prospects > All prospects > Fast tab: General
This business rule can be used for a simple work flow for the creation of a prospect with the relevant data. When changing the business rule status of the prospect, the blocking reason can be updated automatically.
Sales and marketing > Relationships > Opportunities > All opportunities > Fast tab: General
Use the business rule for a simple work flow in the opportunity-to-sales process.
All vendors > Fast tab: General
This business rule can be used for a simple work flow for the on-boarding process of a vendor with the relevant data. When changing the business rule status of the vendor, the blocking reason can be updated automatically.
Released products > Fast tab: General > Group: Administration
This business rule can be used for a simple work flow and can update other fields like blocking reason, "stopped" check marks, life cycle status, depending on the parameters of the rule.
Sales and marketing > Sales quotations > All quotations
This business rule can be used for a simple work flow and a business rule status can automatically be applied when the sales quotations is promoted to a different quotation status. Depending on the business rule status, posting the quotation or posting the confirmation can be enabled or disabled.
Sales and marketing > Sales orders > All sales orders
Use the business rule for a simple work flow in the sales order cycle. In the parameters of the business rule status is specified which actions (like posting the confirmation or packing slip) are allowed, and which fields can be auto-updated.
Procurement and sourcing > Purchase orders > All purchase orders
Use the business rule for a simple work flow in the purchase ordering process. In the parameters of the business rule status is specified which actions (like posting the order or product receipt) are allowed, and which fields can be auto-updated.
Warehouse management > Release to warehouse > Automatic release of sales orders
Warehouse management > Release to warehouse > Release to warehouse
If a sales order has a business rule status that prevents release to warehouse, the sales order is excluded from Automatic release of sales orders, and from the manual Release to warehouse form.
Note
Warehouse management > Packing and containerization > Pack
Packing itself is not blocked with the business rule status, but a clear orange banner "Blocked for shipment" or "Blocked for packing slip" indicates when the shipment contains a sales order for which the business rule prevents shipment confirmation or packing slip posting. The open lines that trigger the block, are indicated with a check mark Block.
Blocked for shipment: in this case, when closing the last container, the shipment is not confirmed. After the business rule status changes and no longer blocks for shipment, the shipment can be confirmed from the shipment list page or the load list page. A shipment can not be confirmed partially, so one blocked sales order within a shipment with multiple sales orders will prevent the confirmation of the shipment.
Blocked for packing slip: in the container packing policy settings, it is possible to print the packing slip when closing the last container on the packing station. However, when the order is blocked for packing slip posting, no header and lines are retrieved in the packing slip posting screen. After the order is unblocked, the packing slip can be posted from the shipment list page or the load list page.
Warehouse management > Shipments > All shipments
The orange triangles in the column Block show that the shipment contains at least one sales order with a business rule that does not allow outbound shipment confirmation or packing slip posting.
A shipment cannot be confirmed if one or more of the sales orders in this shipment are blocked for shipment confirmation. A shipment can be confirmed if only blocked for packing slip occurs at the sales orders within the shipment.
Warehouse management > Loads > All loads
If one of the shipments in the load cannot be confirmed, the whole load cannot be confirmed. In order to ship some shipments in a load, it is possible to transfer a shipment to a new or existing load.
Business rule statusses are available on several entities. Changing the status on such an entity is a manual process or can be triggered by the document status. For example when a sales order is confirmed. An advantage of the business rules is that validation rules are adjusted. More often orders are more-and-more created in an automated way, originating from EDI or webshops. A more volume-based approach is needed to validate and update the status automatically.
The business rules solution offers the functionality to validate and update multiple records of an entity at once, by using the batch function update. For a specified range (via the query) of records for a specific entity the business rule can be set from a selected begin status to the requested end status.
The following menu items are available to start the periodic batch function for an entity (Common > Periodic > Business Rules):
Processing the business rule status update for multiple entities can have both a technical and a functional result. From a technical perspective the batch run is succeeded when all the entity records are processed succesfully. However, from a functional perspective the business owner will be informed about the validations and the business rule status update. So when a business rule update is not completed, due to business rule validation errors, this is only a functional result. This means that the batch job will not give an error but the batch job history contains a functional log with extended (functional) messages about the results of the business rule update processing.
It's also possible to enable the business rule log book for a specific entity which will show these errors.
Purchase order total amount is not calculated automatically when the purchase order is created, due to performance reasons. The order total is calculated on certain actions, like opening order totals or refreshing the related information pane. To be able to use Business rule condition on purchase order total amount, we added this periodic task.
Question: | When I use templates to create e.g. a customer, which business rule status will be set on the new customer, the begin status of the business rule or the status from the template? |
Answer: | It depends of the parameter "Inherit the business rule status from template for". If Customers is added, template status will be applied. |
Question: | When I convert a prospect into a customer, why is the begin status not set on the new customer? |
Answer: | When converting a prospect into a customer standard Microsoft Dynamics 365 for Finance and Operations will apply the default customer template and will take the value from the template. |
Question: | I have installed Copy Released Product and created a copy of an existing item. This new item did not get the begin status of the business rule but it copied the status from the original item. Is this correct? |
Answer: | Yes |
Question: | I cannot set parameters for the business rule. |
Answer: | First you need to save the business rule record, and then the parameter screen can be opened. Click new to load the context sensitive set of parameters for this business rule type. Save the parameters. |