The next concept that we are going to talk about is a time based workflow rules so a war does a time
based workflows time based workflows as the name says they are time based.
So basically whenever there is a requirement that an action needs to be performed after a specific period
of time then we go for Bind based will close.
In fact it is just like our regular workflows but just that the actions take place after specific beaten
off time.
We can cite many examples for that.
Say for example send out an email for feedback after a case is closed after 1 hour after the case is
closed or to send out a follow up email to the opportunity owner.
After three days the opportunity is created or do a field update after a some particular action happens.
So sending out the album message is also.
So basically all of the workflow actions they are supported in by and based on workflows aspect but
just that the time these to workflow actions they take place after a specific beat it off time.
So that does call this time based workflows.
Now let's go to overseas full sort of and try creating the time to workflow This is about salesforce
org goal for workflow tools
and a workflow tools we do not have assets any rules are defined let's create a new workflow tool choose
any object in our scenario let's choose opportunities or even cases our contacts like visual object
we want to choose let me choose opportunity
and given a little name or description I have given a rule name and description.
Basically this workflow all the outcry MVA creating to send a follow up email to the opportunity owner
after three days the opportunity is created basically if no action is taken then a follow up email should
be sent to the opportunity owner and adhere to do more that the time is to actions we can attach only
to the workflows where the evaluation criteria is either created or created and anytime it is editor
to subsequently meet criteria only in these two evaluation criteria we can add time based actions and
not in the second one that is created and every time it is a to do so in our scenario it is only creation.
So let me say a follow up email after email creation so let me just choose create it.
And next is the rule criteria.
So let me say opportunity type equals
new customer save on next and here will be defining a workflow actions and you can see there are two
different type of actions one is immediate workflow actions which gets executed immediately after the
criteria is satisfied.
The next second one is a time dependent workflow actions.
Now let's create a time dependent look for little action.
So here go to ad time.
3 good and then we need to set up the dates.
Say for example three days after opportunity create a date save
and we have added that time to good.
Now let's add the workflow actions.
So what are all the actions that need to take place.
The workflow actions that we see here are actually the same actions that we can add in emitted will
feel actions estimate what immediate workflow actions also begin create a new task email alert field
update and outbound message similarly for time dependent.
Also we have all the options available and here in this scenario let's choose a email alert.
So fill in the details here
I have filled in the details I've chosen a guest email template that is just a best template to have
chosen it just for our sample put list and then I selected the opportunity owner and then save OK.
There is a letter popping up saying that it already exists.
Okay workflow rule.
Let's try to save this.
Perfect.
So now we have created one action that is sending email to the opportunity owner and that comes with
their time.
Good.
What does a time trigger.
Three days after opportunities created and if you want to edit you can edit it here and if you want
believe you can delete the time through.
So now we have created a workflow tool with that time dependent workflow action and the while creating
this app let's let me choose edit and the word while setting up this time 3 good we can see that we
can set it up only for days and hours.
We cannot set it up for minutes or seconds only these two options these others are available.
Once we are done configuring this time dependent workflow click done full effect and let's activate
other workflow.
Awesome patient settings in place so that automatically whenever I look up it sends out system generated
image as it reaches that property it use it generally in real time we have the developer or the administrator
as the default users.
So here also let me choose this save
perfect.
So now that we have a workflow tool in place and that are time dependent workflow action is also added
to it and now that we have these that time three goals in place.
If you ask me like vandal we actually go and check the spending time dependent workflow actions then
go to set up go for time based workflows if he'd be on the monitor.
So here is the list don't all the time based actions that are pending to be executed.
And know you can see that there are more actions as such pending.
Why.
Because we have only created a workflow to little time based action.
But the crazy day is not that satisfied.
Meaning 1 leaving an opportunity is created that time time based workflow action will get good.
All right.
But after we created that workflow to Alaska to no opportunity was created.
So that is the reason we are not able to see it here.
So this also we need to not what filled or not regard retroactively meaning if you create a ruling now
the rules are not applied to previously created records.
So that does wait for all the previously created opportunities.
This rule will not apply.
This really really only applied to opportunities created from now so only for the future opportunities.
So now let's try to trigger this workflow tool by creating a new opportunity.
So go for opportunities let me try to create a new opportunity.
Say my test opportunity choose a date.
Choose a stage best set now that the opportunity is created the workflow really would have got pretty
good.
So as a world filled with has got triggered automatically that I embraced workflow action would also
have gotten it good.
And how do we check that.
We go back to the same a monitor time based workflows and if you refresh the page and then you give
the object as opportunity you should be able to see the workflow action that is pending so you can see
that for this opportunity the workflow ruling name is this and the scheduled date is basically three
days after today.
So that is why you know two days a 20 thought.
And it is a saying 26 because we have given three days after create a date so all your time based actions
will be killed here.
If you go to monitor time based workflows you should be able to see all your time based actions that
are pending.
So here are the scheduled date that this are twenty sixth of June.
That email alert would get emailed to the opportunity or net alright.
So this is not a straightforward scenario like after three days the opportunity owner will get an email
alert but just in case.
In the meantime within that three days time period if the criteria is not satisfied.
So what does our criteria our criteria is that the opportunity type should be new customer.
Right.
So that does our criteria.
In the meantime if the criteria is changed to a different type in such a way that the criteria is not
satisfied saying that me edited I let me change that type to some other different type and save it.
All right.
So this right guard no longer satisfies the criteria for that workflow.
So in that scenario what happens is automatically
Yeah.
So it is no longer there.
So in this scenario what happens is automatically Sands falls and removes that time dependent actions
that that dude for that guard
similarly even if that a card gets deleted.
So a V now created an opportunity that triggered this workflow action.
Right.
So in this day three days a time period if that opportunity record gets deleted.
Even in that scenario automatically sales force or remove all the time dependent actions.
So this is about the time based workflow and in our example we consider the requirement that enough
of an opportunity is created.
One time this action has to take place.
Similarly we can also consider on the requirement of it and we can say that the evaluation criteria
is created and subsequently then edited to meet the criteria.
Right.
Under these two circumstances we will be able to create a time based actions.
So if we leave the work fluidly wasn't the other criteria basically created and subsequently edited
to meet the criteria even in that scenario then particular regard triggers the workflow action and if
the time to good gets a trigger then it could automatically be a here and in a similar scene scenario
within that particular time frame say for example the time period is within two days.
So within the two days if the criteria is not met you know that the record is updated in such a way
that the criteria is no longer met then index and that scenario also automatically these time based
actions will be removed.
But the difference is that when the criteria is set to created and anytime subsequently meets criteria
it is possible to bring that look flew action again when the record is again abated in such a way that
it meets the criteria.
So let's say for example the criteria is a type equals customer so of envy or create an opportunity
or and like the type equals customers so automatically we get a time to go here and within the due date
time period if we change that type from New customer to a different type it means the recorders are
no longer meeting the criteria.
So in that scenario that time to good will be automatically removed from here but then later on again
if you change the if you are big that a card to again type equals new customer in such a way that it
meets the criteria then again like though time based workflow action will be added up here but that
doesn't only when the evaluation criteria is created and any time it is edited to subsequently meet
the criteria but not in create it.
That is the fullest option.
The one that we actually discussed was the first option that is created but they leave then it is created.
And the later on is the right two days abated in such a way that it no longer meets the criteria.
Then in that case the action would be removed and it can no longer be added again.
So this is all about.
I am based workflows.