In the previous sessions he understood how to use a process builder for auto creating records.
Now let's understand how do we use this awesome process builder to update child records in our system.
So for this let's consider a business scenario so other scenario is that whenever an account gets deactivated.
UPDATE ON IT'S RELATED open opportunities to close to lost out.
This is of a business requirement.
All right.
So what is a condition here then about an icon gets deactivated so that does when other actions should
take place.
So a phone gets deactivated meaning maybe there is a active field and you know you basically deactivate
an icon.
And I bet all it's a related open opportunities.
So when we say legit opportunities here in our case it means Chinese red.
Right.
So child opportunities of a company and open opportunities so we know opportunities can be open or closed
so close to means.
The stages either close lost or close to one and other lost all stages are considered as open opportunities.
So to update all it's a related open opportunities to close lost.
So this is our scenario.
For such a business requirement actually there may be few other ways also to do it like we can use Apex
trigger order we can use this process builder in combination with a floor.
So there are a couple other methods also to do this.
Now let's understand how do we do this using just process data go do have a dog and he have process
build that let's create a new process now so you may already have other processes here.
Now let's create a new process fill in the details
also mentioned when the process needs to start here it should start with network or changes save the
effect of a new process is ready to be designed and long.
Now let's create.
Now let's choose which object in our scenario this process should start.
Basically in the compass would be activated so the object is account
and the criteria is then the record is created or edited.
All right.
Because basically then an account is created on maybe when it is edited later time.
Even in that scenario that code can be deactivated.
So we just created or edited save.
Now we have defined when to start the process.
Next let's add the criteria.
So our criteria is when the account was deactivated.
So let me say on account the activation and here we have to define what defines actually the account
the activation in the account object.
We have a field that is an active field which is a pick list field and it has values.
Yes ordinal.
So let's use this field in our process.
So use this active backless field.
Equals.
It's a big list and when it says no so basically when the FDA activating it and this is our only criteria.
So let's save it.
Our criteria is also defined.
And when the criteria is satisfied what all the actions.
So the action is to update records basically update the related open opportunities.
So in that scenario let's choose the action type as a bit of a class.
OK.
And the action name is a bit related opportunities so choose opportunities and that he had when we say
update regards process Berger gives us the option.
He does asking us whether it will abate the contract guard which started the process Onyx a related
records.
So process moving has this capability of updating related records as well related pattern related child
any related records so process Berger can be used to update the related records aspect but nine numbers
in that you know we are choosing a related record.
So let me go for the second option.
And when we say related record we need to say which related record.
And here it is.
Opportunities
and then comes the criteria for updating records.
So we need to define whether all the related records should be updated meaning all the related opportunity
should be updated or is there any specific opportunities to be updated.
So ask but our business scenario we need to update only the open opportunities so opportunities we have
open opportunities and closed opportunities.
So what are closed opportunities all opportunities within the stage is either close to 1 or close lost
they are closed opportunities and what does open opportunities on the other opportunities are basically
open opportunities meaning opportunities where the stage is not close to one or two lives lost.
So they are open opportunities and in opportunities object we have a field the closed feel that we can
use for all these configurations that that if you want to choose whether an opportunity is open or closed
we can use that particular field.
So that does call this is closed.
So that particular field we are going to use and we are going to separate out all the open opportunities.
So we have a great idea here.
We don't want to update all the opportunities we want to update only the open opportunities.
So let me.
Oh sorry.
Let's define the condition now so the opportunities status should be equals force.
Right.
So if he is closed if that field equals force basically does an open opportunity.
So we have user criteria and only those opportunities which meets this criteria will be updated.
And now we need to define what is the update that needs to happen on all these opportunities which means
this criteria.
So in other scenarios we need to update the stage to close lost.
So we have defined our action.
We have given the action type.
We have given the action name.
We have also mentioned it is the opportunities of account and then it does not.
All the opportunities but only the open opportunities and floor on the open opportunities associated
with that account.
We need to update the stage value to close lost.
So this is an action that we have defined.
So once we have defined all this let's save it for effect.
So we have defined over the thing now of our process.
But let us ready to be activated.
So let's activate the process perfect.
It is not activated.
Let's go ahead and check it in you like so.
This is our account.
Let me choose this account.
So here I have actually done already our data set up.
You can see this is an account and it has photo opportunities among those that do walk lost opportunities.
And the other toward open opportunities.
Now let's deactivate this account.
You can see this account is activated.
Now let me go ahead and deactivate this account.
Perfect.
Now the account was deactivated.
So what you would ideally happen all the open opportunities should be updated to close lost.
Now let's check the opportunity status all the open opportunities are updated to just lost the close
to 1.
It remains ss.
So this is how we use process builder to update child records in a similar fashion you can also use
the process to update the same icon icon next doctor.
The process but.