Announcement

Collapse
No announcement yet.

Workflow formula for updating multiple target records

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Workflow formula for updating multiple target records

    Hi. So I have created a workflow that would update an entity's stage field whenever the stage from the target entity is changed to 'rejected'.

    I have attached the workflow I created.

    Problem is, the Deals entity does not get it's stage updated after I changed the stage of the Order's record

    Can anyone help me? Thanks in advance.

  • #2
    This workflow is triggered after Order record saved and has status Rejected (even status is not changed to Rejected right now, but was before saving).
    Is there something in Workflow log?
    what relationship type is between Orders and Deals?
    Also check espocrm log. You can even switch on Debug log mode and thy to trigger your workflow again

    Comment


    • #3
      Originally posted by tanya View Post
      This workflow is triggered after Order record saved and has status Rejected (even status is not changed to Rejected right now, but was before saving).
      Is there something in Workflow log?
      what relationship type is between Orders and Deals?
      Also check espocrm log. You can even switch on Debug log mode and thy to trigger your workflow again
      https://github.com/espocrm/documenta...e-for-a-logger
      Thank you for the reply Tanya.

      This workflow is triggered after Order record saved and has status Rejected (even status is not changed to Rejected right now, but was before saving).

      - Yes this is correct. When I update the status to Rejected on Orders, the workflow triggers.



      Is there something in Workflow log?

      - Yes there is! Actually the workflow triggers on stage change on Orders entity. What I want is for the equivalent record from Deals to also change it's stage to Returned.



      what relationship type is between Orders and Deals?

      - Hmm. For this one, from our process, Deals is being converted to Orders using the convert button function (since Deals is a copy of Lead). So there is a field 'createdOrderID' in the entityDefs of Deals which contains the Id in Orders (via database check). So I assume I can use it as their link? If it isn't the case, then what link or relationship can I use?

      I'll be checking the espocrm log. Thank you for the great answer!

      Comment


      • #4
        Additionaly, here is the log for the workflow:

        [2018-10-16 02:29:30] Espo.DEBUG: WorkflowManager: Start workflow rule [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: WorkflowManager: Condition result [1] for workflow rule [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: WorkflowManager: Start running Actions for workflow rule [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: Workflow\ActionManager: Start workflow rule ID [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: Workflow\Actions: Start [updateRelatedEntity] with cid [0] for entity [Order, 5bbc04b3b9c6bbd1a]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: Workflow\Actions: End [updateRelatedEntity] with cid [0] for entity [Order, 5bbc04b3b9c6bbd1a]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: Workflow\ActionManager: End workflow rule ID [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: WorkflowManager: End running Actions for workflow rule [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: WorkflowManager: End workflow rule [5bc40f3a72668ab98]. [] []
        [2018-10-16 02:29:30] Espo.DEBUG: WorkflowManager: End workflow [afterRecordSaved] for Entity [Order, 5bbc04b3b9c6bbd1a]. [] []

        Comment


        • #5
          could you attach entityDefs of these Entities?

          Comment


          • #6
            Originally posted by tanya View Post
            could you attach entityDefs of these Entities?
            Sure. Here they are:
            Attached Files

            Comment


            • #7
              What we want to come of with is like a backflow. Wherein, when in Order entity, a record has it's stage updated to Rejected, it will update the record in Deals to Returned.

              As per our process:

              Deal (named Del, and a copy of Lead entity) can be converted to Order. This is being converted properly but it seems that the updating of Order going back to Deal can't be done on workflow.

              Also, I created a workflow just to test if there is a relationship between Deal and Order. I have it to check if the stage in Deal is changed to Returned, it will update the stage in Order to Rejected, and this worked.

              What does not work is from Order to Deal.

              Can you help me on this? Thank you.

              Comment


              • #8
                Hi Tanya. Anything on my question? Thank you.

                Comment

                Working...
                X