 Hello everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate a scenario based on record tracker flow. So let's understand the requirement of record tracker flow first. So I'm going to demonstrate how you can update child record once your parent record is updated. So it is kind of parent to child field update. And this I'm going to demonstrate with the help of loop element. So in previous demo, I explained the same requirement without using loop element, but you should know how we can use loop element in the record tracker flow. So that's why I'm explaining this requirement again using loop element. So the requirement says when account phone is updated, then we need to update related contacts home phone field. So I'm going to create new flow selecting record trigger flow. So here I need to select account then record is updated. Then here we need to apply the condition. So condition should be phone is changed. So phone field is changed. Then only this flow should work and actions and related record because I'm going to update the related records related to account. Those are contacts clicked on done. So now I need to fetch all the contacts first. So I'm using get record get contacts. Here I need to fill contact. Now I need to fetch those contacts which are related to the account which we updated. So here I'm writing account ID equals record dot ID. So here whenever we use record trigger flow, so the flow will receive all the information of the record through which the flow is triggered in this dollar record variable. So through that I'm fetching ID of that account record which is updated if it is equals to account ID. So this account ID is a lookup that is available on the contact. If contact account ID lookup matches with this record ID, it means the contact is related to that account which we updated right now. So we need to fetch and we need to fetch all the records which are related to that account. Then I'm clicking on done. Now after this I need to check whether this get record or get contacts is null or not. So I'm just applying a decision. So if it is not null, then only we want to proceed. So get contacts is null, false. So you will see two paths here. So we need to go to this not null path. So here I am ending this. I need to select hand from here. So now here we will be implementing the loop. So if this get contacts is not null, then only we need to perform the operation. So if it is not null, it means we varied all the contacts which are related to the account. Now we need to update those contacts home phone field with the account phone. So I need to iterate a loop. So I'm just selecting a loop element. So iterate over contacts and here I'm selecting a collection variable. So basically whenever you use get record element and you select all records option. So let me show you that if you use get record element and you select this all records option. So this element will become a collection variable automatically. So now if I use a loop, so here this collection variable I can use and here we have two directions first to last or last to first. So I'm choosing first to last and clicking on done. So this way this loop will be available here. Now one by one each contact will be iterated and we need to update its home phone with the account phone. But inside the loop we cannot perform DML operation. Inside this loop we cannot perform DML operation. So we cannot use this update record element directly. So what I need to do, I need to create a resource of type variable. API name is contact record, its data type is record and object time selecting as contact. So basically I'm going to store the contact information temporarily in this contact record and clicking on done. So here you can see I created a record single variable which is available here. Now after storing contact information in this contact record, I need to add this contact record into a list because there can be more than one contacts related to that account. So I need to create one more resource as variable. Its API name will be contact list and selecting record, object is contact and this time I'm enabling this checkbox. Allow multiple values so it will become a collection variable and I clicked on done. So we created a contact record this and we created a contact list this. So in contact list we need to enable this checkbox. Now here I'm clicking on plus and using assignment. So we need to assign contact information into that contact report. So contact report dot ID equals. So now you will be having contacts one by one through that loop element. So you need to search for loop over. So here you will find current item from loop. So current item will be having all the contact records one by one. So first contact record will be available this time. So I'm selecting it and I'm having its ID. So which contact we are adding in this contact record that's ID will be assigned. Now again I need to select contact record dot home phone equals. Now the account record which we updated its information will be available in this record variable. So through that we can fetch the phone value. So this way one by one each contacts information will be available in this contact record. After this we need to have one more assignment variable. So now we need to add the contact record into the list. So here I'm having contact list then you need to select add and here you can select contact record. So select don't select any field just click outside. So this contact record will be added into this list and click on done. So this way loop is implemented. So you can see one by one each contact record will be iterated. It will be assigned to the contact record that contact record will be added to the contact list. Now after completion of this loop here you need to use update record and we need to update contact records. So we can write update contact records this time we will be selecting the second option. Use the IDs and all fields no. So yes use the IDs and all fields from a record or collection variable. So from here I'm just selecting contact list. So in one go all contact records will be updated with the account phone and that account phone will be available in the home phone. So this way this whole scenario is implemented. Now I'm just going to save it activating this and I'm going to show you like my previous flow that I implemented is deactivated. So here you can see update related contacts without loop it is deactivated right and update contact phone using loop is activated. Now if I go here so I have three sorry two contacts associated and both are opened in different tabs as well. So I'm going to update the phone number so I am adding zero zero zero zero and save right. So if I go here and refresh so right now it is having four lines at the end if I refresh so it is having four zeros. If I refresh it it will also be having four zeros at the end of that phone. Okay so this way with the help of this loop I demonstrated you how we can perform parent to child field update. So you should know both the ways sometimes you need to use loop sometimes you can do it without loop. So this way I hope you understood how we can update parent to child fields using loop element in the record trigger flow.