• Purpose: Apply conditional client-side logic on a form. Handles some tasks normally needing JavaScript. Not designed to replace scripting.
  • Can run for one or more of an entity‚Äôs forms; this sets the scope of the business rule.
  • Works in browser, tablets and mobile phones.
  • Each form can have 0..n business rules.
  • Each rule is evaluated on form load or when field value changes and condition is met. They are not run when saving a record.
  • Conditions: 1..n for same field or multiple fields; logical AND only (no OR); Can only select from fields for the target entity (no related entities); Operators: Equal, >, contains data; Compare on other field, by value or formula
  • Actions: Set field value (fixed, other field value or formula calculated); set required; hide/show; lock or unlock; display error message (next to field)
  • Field referenced in rule must be on the form. If not, no error is thrown.
  • View/edit business rules in Solution explorer, from a field definition or from a form
  • To test rules, you can preview an entity form. Activated and draft rules run in preview mode.
  • Must deactivate business rule before editing it.
  • Use Save As" to copy a rule.
  • Limitations: Cannot: Clear fields (unless using known "blank" fields for this purpose), Reset field changes caused by rules, Modify rules while activated, Set scope to only include a Quick Create form, Hide/show sections or tabs
    • It appears that a field referenced in a business rule must be on the form, otherwise none of the actions will take effect.

One Way to Copy a Business Rule for a Different Form

If you have a business rule on a form and you want to copy it for use for a different form (for the same entity), and also don't want the business rule's scope to be "All Forms", then one option is to recreate the business rule manually for the other form. But there's a faster way to copy a business rule that works, as long as you're comfortable modifying CRM solution zip files and some XML.

The procedure outlined below involves copying most of the XML from the XAML workflow file (the actual business rule logic) to the XAML file for a different business rule -- one that's applied to the other form where it needs to run.

  1. Create a solution that includes the entity that has the business rule to copy.
  2. Add a new business rule in the solution. For the business rule condition and action, just add something simple because this logic will be overwritten from a different business rule. Also, be sure to set the scope of the rule to only the new form.
  3. Save the new business rule. Make note of its name.
  4. Publish All Customizations
  5. Export the solution.
  6. Extract the solution zip file to a temp folder.
  7. In the Workflows folder, find the .xaml file for the source business rule (the one that you are copying from). Open that .xaml file in a text editor.
  8. Open the .xaml file for the new business rule in a text editor as well.
  9. Starting with <mxswa:Workflow>, copy from that point to the end of the file. Paste that XML fragment over the top of the same XML fragment for the new business rule. Save the changes to the new business rule .xaml file.
  10. Add the updated .xaml file back into the solution zip file you exported earlier and import the updated zip back into CRM.
  11. Publish All Customizations
  12. Your new business rule logic should now be in place.