Skip to main content

Required Outcome

When a Partner Action Log record is updated and its Parent Engagement field changes from one engagement to another, the flow should update both the old and new parent engagements to reflect accurate action counts based on all associated action logs.

Flow Element Execution

Start Conditions:

  • Flow triggered when a Partner Action Log record was updated
  • Entry condition: Action_Type__c Equals "Demo"

Decision: Parent Engagement Check

  • Outcome executed: Parent_Changed
  • Conditions met: Partner_Engagement__c changed from prior value to new value

Get Records: Get All Action Logs - Parent Changed

  • Query: Find all Partner Action Log records where Partner_Engagement__c equals the prior/old Partner Engagement value
  • Filter: Id does not equal the current triggering record
  • Result: Successfully found records (multiple records retrieved)

Loop: Loop Action Logs - Parent Changed

  • Iteration 0 executed
  • Loop through all retrieved action logs associated with the old parent engagement

Assignment: Assign Count - Parent Changed

  • Variable updated: varActionLogs incremented by 1
  • Result: varActionLogs = total count of action logs associated with old parent (excluding current record)

Loop: Loop Action Logs - Parent Changed

  • Loop completed

Update Records: Update Partner Engagement - Parent Changed

  • Find Partner Engagement record where Id equals prior/old Partner Engagement value
  • Update Action_Count__c = varActionLogs
  • Result: Old parent engagement updated with accurate count (excluding current record)

Get Records: Get Action Logs of New Parent

  • Query: Find all Partner Action Log records where Partner_Engagement__c equals the new Partner Engagement value
  • Store field values: Id only
  • Result: Failed to find records (0 records retrieved)

Loop: Loop All Action Logs - New Parent

  • Loop completed with no iterations (since no records were found)

Update Records: Update New Parent Engagement

  • Find Partner Engagement record where Id equals new Partner Engagement value
  • Update Action_Count__c = VarNewCount (0)
  • Result: New parent engagement updated with count of 0

What is missing here in reparenting case for the new parent? How can I debug this issue? The structure seems fine to me. However, I know that I am still missing something and would appreciate if it is pointed out. Thanks!!

답변 2개
  1. 3월 16일 오전 10:35

    @Fahad Khan The issue is most likely that your flow is running before the record is saved. In the reparenting case, the triggering Partner Action Log is still not available under the new parent when you do Get Records, so your new parent query returns 0.

    What to do:

    • Move this logic to an after-save record-triggered flow
    • Then recalculate counts for:
      • the old parent
      • the new parent

    Also check:

    • Reset VarNewCount before counting new parent records
    • Make sure your Get Records for the new parent includes the moved record after save

    Thanks 

    Manoj

0/9000