Sunday, 12 July 2020

Flow to Delete a Child Record

Hello Folks,

Hope everyone is staying safe.

In this Blog, we are Going to Learn How to create a flow to delete a Child record.
Lets understand the usecase and Implement it-


Usecase- Adam is the Account Owner of Account "Apextips" and he is observing that there are many associated Contacts records having Lastname as "Test" or something  a common name which he don't want to get  shown on Account in the related contact list records. So he want that when Account Record is Edited/Created then all the associated Child contacts having last name "test" will automatically gets deleted

Didnt understood? No Problem
Action Speaks More than Words




Lets try to Solve Adam's Problem-

There are 2 Solutions for that-
1) Calling a Apex Class from Process Builder to delete child record(Contact)
2) Creating a Flow to delete child record(Contact)

We are going to Implement Solution 2 in this Blog, Lets Implement it-

Lets Create Flow First-

Step 1- Go to Setup and search "Flow", then Click on Flows

Step 2- Click on New Flow and select "Record-Triggered Flow" 

Step 3- Select the Object "Account" and click on edit and enter details as below snap

















Step 4- Drag the "Get Records" Component in workspace and fill the details as shown in below snap



















Step 5- Join first component and second component using connecting dots

Step 6- Drag the "Workspace" Component in workspace and fill the details as shown in below snap


















Step 7- Connect the dots between "Get records" and "Delete records"

Step 8-  Save your Flow and Click on Activate

Step 9- Testing of Flow
  • Create 1 Account named "Apextips"
  • Create 1 Contact having LastName = "Test"
  • Edit any field of Account, Your test contact will automatically gets deleted


Hurray......We are Done with the implementation.

Hope you Learned something New

Stay tuned for upcoming Blogs.
Thanks

Happy Learning😊


Contact:
Twitter Handle : Lakhan Meghani
Apextips Twitter handle : Apextips
linkedin :                              Lakhan Meghani 

No comments:

Post a Comment