Configuration Best Practices

Jump to

Workflow Rules

Evaluation Criteria

When a workflow rule is enabled, the evaluation criteria for that rule is queried each time the corresponding entity is updated or created.

It’s important to ensure the evaluation criteria are set up based on the following rules and order to ensure optimal performance.

  1. Order of simplicity: the most simple expression comes first
  2. When using AND the least likely expression should be first
  3. When using OR the most likely expression should be first
  4. Use IsChanged() in “Every time a record is created or edited”
  5. Use catch() instead of IsNull() on nested references

Rule #1 – Order of simplicity: the most simple expression comes first

mceclip0.png

Rule #2 – When using AND operators the least likely expression should be first

mceclip1.png

Rule #3 – When using OR operators the most likely expression should be first

mceclip2.png

Rule #4: use IsChanged() for “Every time a record is created or edited”

mceclip3.png

*IsChanged() doesn’t return true if it's a new object (use IsNew() instead)

Rule #4.1: Reduce executions on user-related workflows by ignoring logins

mceclip4.png

Rule #5: leveraging Catch() instead of IsNull()

mceclip5.png

* For other types of validations, prefer If block over Catch()

Actions

Rule #1: Leverage variables to avoid multiple function calls

mceclip6.png

Rule #2: Do not use SysId as an object reference

mceclip0.png

Custom Fields

Formula-based Custom Fields

Formula fields will only be calculated when an object is changed, and only when the fields in the formula depend on change.

  • In general, Formula fields and workflow rules run at the same speed
    • Optimally, all database columns load prior to execution
    • If an entity was modified concurrently (in a different transaction), a job is triggered
  • Formula evaluation criteria needs to be as simple as possible based on the evaluation criteria rules

Rollup Fields

Rollup fields are slower than formula fields or workflow rules but they are calculated inside the project calculation process (i.e. in memory), so their overhead is still small. If you have many of those then you will slow down any update to the project.

  • It’s very hard/impossible to implement rollup via workflow rules so you don’t have much choice here
  • The Formula and Rollup criteria need to be as simple as possible based on the evaluation criteria rules

Relation summary fields

  • Relation Summary fields are the slowest type of custom field
  • Runs as a groupable job (outside of the Save transaction)
  • Workflow rule may be more efficient in some cases
    For example, if you are implementing Count by referencing additions and deletions of links and just incrementing or decrementing the counter
Have more questions? Submit a request

Comments