Check if all related record are in a certain stage and if they are trigger workflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mark
    Senior Member
    • Dec 2019
    • 143

    Check if all related record are in a certain stage and if they are trigger workflow

    Hi,
    I wanted to ask if it's possible to make a condition for a workflow, which would check if all the related records from a certain entity are, for example in "completed" stage, and if they are a workflow that sends an email would be triggered.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi Mark,
    Try to set a Formula condition for Workflow like this:
    Code:
    entity\countRelated('opportunities', 'open') == entity\countRelated('opportunities')
    In this case, it checks whether the total number of the related Opportunities records that is 'Open' is equal to a total number of the related Opportunities records.
    In this case, 'Open' is a filter (see screenshot). You can create the same filter by utilizing the Report feature. Read about this here https://docs.espocrm.com/administration/formula/#filter.
    Little manual.
    1. Create a report
    2. Create a report filter in Administration -> Report Filters
    3. Use the filter in the Formula condition.

    Comment

    Working...