Transfer all Contacts(child) from the Account(parent) to the Parent Account(grandparent) when the Account(parent) is deleted (Delete in Flow) #inSalesforce

Transfer all Contacts(child) from the Account(parent) to the Parent Account(grandparent) when the Account(parent) is deleted (Delete in Flow) #inSalesforce


Suppose sampleAccount have parent sampleParentAccount. On deletion of sampleAccount, the related contacts sampleContact1 and sampleContact2 (of sampleAccount) will be related to sampleParentAccount or transferred to sampleParentAccount


START ELEMENT:

Operation: Delete

Object: Account (when account delete is triggered)

Criteria: parentId isnull false


GETRECORD ELEMENT: getContacts

Get the contacts related to the Account (criteria - accountId equal currentRecord.id - the account on deletion of which flow was triggered)(all contact records)


DECISION ELEMENT:

Null Check - getContacts isnull false


LOOP ELEMENT: (loop through all Contacts - loopVar)

Loop through all Contacts


ASSIGNMENT ELEMENT: assignToParentAccount

currentLoopVar.accountId equals currentRecord.parentaccountId - the account on deletion of which flow was triggered parent Account Id


ASSIGNMENT ELEMENT: 

To collect the updated Contacts (looped through) (new resource - allContactsCollector, datatype - record (multiple), object - Contact)  ADD currentLoopVar Item(no dot, remove the dot)


UPDATE ELEMENT:

update the Collector to finally update the Contacts that is update allContactsCollector


Connect All, Save and Debug


Test the following:

Suppose sampleAccount have parent sampleParentAccount. On deletion of sampleAccount, the related contacts sampleContact1 and sampleContact2 (of sampleAccount) will be related to sampleParentAccount or transferred to sampleParentAccount


Screenshots:














Visual: https://www.youtube.com/watch?v=mqBMqopw4mo


Comments