馃攳
Business Days in Salesforce CRM Analytics (Tableau CRM) - YouTube
Channel: unknown
[9]
Today we'll be looking at generating business聽
days within sales cloud to use in Tableau CRM聽聽
[14]
analytics studio. In order to start with聽
making these business days we'll first聽聽
[18]
need to establish our business hours within our聽
company settings. We'll do this by going into聽聽
[22]
the quick find box and then typing in business聽
hours and locating the business hours object.
[41]
Okay under company settings in this business hours聽
object, this is where you will set your business聽聽
[46]
hours to let Salesforce know what days are聽
business days and what days are not business days.聽聽
[52]
I went ahead and chose Monday through Friday.聽
They all have 24 hours so Salesforce will consider聽聽
[57]
Monday through Friday a business day but won't聽
consider Saturday and Sunday a business day.聽聽
[63]
On this object you will also be setting up your聽
holidays for your company. I went ahead and I聽聽
[68]
selected a few holidays, some of which fall on the聽
same date every year, some of which are a specific聽聽
[75]
week in the year. It's good to keep in聽
mind when it comes to observable holidays,聽聽
[81]
say you have a holiday fall on a Saturday and聽
your company decides to observe it on that Friday,聽聽
[87]
Salesforce will not automatically decide聽
whether that's a business day or not.聽聽
[93]
It will consider your Friday to be a聽
business day so in your apex code you聽聽
[97]
will have to roll out your own logic in order聽
to get them to not consider it a business day.聽聽
[104]
After you have established all of your聽
business hours and your holidays you聽聽
[107]
will want to create a custom object in order聽
to store the records for your business day.聽聽
[112]
I will go ahead and go over to my custom object. I聽
went ahead and just named it business day to keep聽聽
[118]
it simple. And it is a fairly simple object, the聽
only custom field on it is the custom date field.聽聽
[125]
This is where it's going to store that聽
specific date if it's a business day.聽聽
[130]
After establishing your business hours and聽
holidays and creating your business day object,聽聽
[134]
you are ready to use these in your apex code to聽
then generate all of your business day records.聽聽
[141]
Alright before we start generating our聽
business day records within our apex class,聽聽
[147]
we will need to instantiate two different date聽
time variables, one being the start date time聽聽
[152]
and one being the end date time. And then we'll聽
also instantiate a list of our business days.聽聽
[158]
We will then loop between our start date聽
time and end date time and we are actually聽聽
[163]
going to utilize the is within function聽
that is standard on the business hours聽聽
[169]
object. This function takes in an ID of your聽
business hours and a date time variable as聽聽
[175]
the parameters and will return whether that聽
given date time is within your business hours.聽聽
[180]
This is why we went ahead and established all of聽
our business hours and holidays in Salesforce so聽聽
[185]
that it can actually pull in whether that is a聽
business day or not. If the date actually does聽聽
[191]
fall on a business day, that is when we'll聽
actually create another business day record.聽聽
[198]
And it sets the date of that business day聽
to the current date that's in the loop.聽聽
[203]
I went ahead and added for it to set the name as聽
a certain specific format just to make it a little聽聽
[209]
easier to read and then it goes ahead and adds聽
that into our business day list we just created.聽聽
[217]
After it is done looping through all of those聽
dates between the start date and the end date,聽聽
[222]
it goes ahead and inserts that into聽
your database and it's ready to be聽聽
[226]
used within Tableau CRM. I went ahead and I聽
executed this code within our developer console,聽聽
[232]
but what you'll want to do is actually have聽
this logic for generating these records聽聽
[237]
automated with a scheduled automation that runs聽
the first day of the year. This just eliminates聽聽
[242]
the hassle of having to manually execute the code聽
each year just to get your business day records.聽聽
[249]
Alright so within sales cloud what we're聽
going to do is go into analytics studio
[256]
and here in analytics studio what we need to聽
do is create a data flow that will pull in the聽聽
[262]
business day records we just created and then it聽
will register it to a data set which will then聽聽
[267]
allow you to use it within Tableau CRM analytics聽
studio. So first we're going to go to data manager
[278]
and then next we are going to be聽
going into data flows and recipes.
[285]
And here in data flows and recipes we're聽
going to go ahead and hit create data flow.聽聽
[289]
I'll call this business days,
[294]
hit create and here we're just going聽
to create a two-step data flow,聽聽
[300]
very simple. We're first going聽
to start off with the digest.
[307]
This digest is actually just going to聽
call into our Salesforce organization聽聽
[312]
and we can pull whichever object we聽
want and pull out the data that we want.聽聽
[318]
I'm going to go ahead and name this node.
[328]
And after naming it we can go ahead and select聽
which object we will be pulling in. Of course聽聽
[334]
will be our business day object. And you聽
can even select which field you want to pull聽聽
[340]
in. Really the only field I'm going to need is聽
the date field, so we'll do that. Go ahead and hit聽聽
[347]
create and then next will be our final聽
step which is going to be a register聽聽
[352]
step. Alright we'll go ahead and select聽
register, give this node a name as well.
[371]
Source node will be the digest node.
[377]
Call the alias business days,
[389]
hit create. And after hitting create we're聽
going to go ahead and update data flow.
[400]
And now that it is ready to聽
run and we'll run our data flow
[406]
and we can even monitor what the process聽
is. It is still currently running,聽聽
[410]
but when this is done running this will actually聽
have all of your business day records pulled in.聽聽
[416]
You'll have that data set and with聽
that data set you'll then be able to聽聽
[420]
use it within your SAQL queries on and on聽
your dashboards in this analytics studio.
[428]
If you are looking to add business聽
days or even wanting to customize聽聽
[431]
your business days you have in聽
your Tableau CRM analytics studio,聽聽
[435]
please contact DB Services and聽
we'll be happy to help you.
Most Recent Videos:
You can go back to the homepage right here: Homepage





