Relating One Case to Another Based on Status

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pehoma
    Member
    • Aug 2022
    • 58

    Relating One Case to Another Based on Status

    Hello ESPOCRM Community,

    We are looking for a way to establish relationships between cases in our system based on their status. In our setup, each customer can have multiple cases running simultaneously. However, in some situations, one case cannot proceed until another is completed.

    We would like to introduce a status called "Waiting for Another Case", where we can select the specific case(s) that must be completed before work on the primary case can continue. Ideally, the system should automatically update the status of the primary case via a workflow once all the required cases are marked as completed.

    Has anyone implemented something similar, or is there a recommended way to achieve this in ESPOCRM? Any insights or best practices would be greatly appreciated!

    Thanks in advance!
  • macistda
    Member
    • Jul 2022
    • 88

    #2
    Should be possible.

    $changedstatus=entity\isAttributeChanged('status') ; // is true or false
    $status=entity\attribute('status');
    ifThen($changedstatus==true&&$status=='Waiting for Another Case',record\findRelatedOne(...);record\update(...));


    Check here:


    Comment

    • dimyy
      Active Community Member
      • Jun 2018
      • 576

      #3
      To count the number you can use entity\countRelated(LINK, [FILTER])

      This will not help prevent the change of the status of the leading Case.

      Maybe a service field that will be updated with each change of the status of subordinate Case will help. Then checks for the number of open cases in this service field at the settings "before save script" level or at the field conditions level. I'm not sure that it will be possible to do this at the workflow level.

      Comment

      Working...