Salesforce Certified Platform App Builder – 3 – Data Modeling and Management
- Creating a Geolocation Field
So now we’re going to create a geolocation field. I’m in the object manager under the campaign standard object and then going to the fields and relationships. We have our different fields that are either standard or we’ve created. And I’m going to click the new button and select Geolocation under the data type. One of the newer options available for the past couple of years, I guess now is this geolocation option and a geolocation field. You may not be familiar with this. This has to do with allowing users to define locations and this would be locations on the globe actually. It includes latitude and longitude components and can be used to calculate distance. So now scrolling down to reveal the next button, I need to give this geolocation field a label.
So I’ve put in here enrollment location. And so the idea behind this in our scenario is we’re working with campaigns. One of the calls to action of this campaign would be encouraging people to go to a specific location. And that could be like for a job fair or enrolling for a program or a training program. And so we want to record at the campaign level the actual location through a geolocation field. And so I’ve got this field label for enrollment location. So our campaign has to do with encouraging people to go to this specific location. So the latitude and longitude display notation can either be in degrees minutes and seconds or decimal.
Now we’re not going to go into all the ins and outs of all this, but we’re just going to leave this degrees minutes and seconds. Let’s click next. We see that the decimal places filled is required. And so we’re going to have this be to one decimal place. If you wanted a finer accuracy of the geolocation, you could do two decimal places, et cetera, but we’re just going to go with one and click Next. And then I just want to verify that this is available on the system administrator profile and the custom marketing profile. These are the primary profiles we’ll be using in this course. We may get into some of these others, but for the most part, for most of these fields, you’ve probably noticed I’m just concerned with just going with the defaults and then click Next.
And then I’m going to add this to my campaign layout. So we created a geolocation custom field. What I’m going to do is go back to my campaign that we’ve been working on and go to the details screen and let me go ahead and refresh, let me look and see if it’s there. I don’t see it. So I’m going to refresh my browser and see if it’s there before entering data. So I’m back on the campaign, I click the details and so now by refreshing the screen, you’re able to see a new custom field and lightning experience before there’s been data entered. And so as you can tell, I’m figuring out some of the nuances of lightning experiences I record. And this will be an improvement that I’m sure salesforce will address in the future to where you don’t have to click refresh.
But I’m trying to show you all the ins and outs so that we reduce the amount of confusion, hopefully, as you traverse through the course. So I’ve double clicked in the enrollment location geolocation field. I want to put in a latitude of 35. 9 and a longitude of 86. 7. And so you can pull up longitude longitude information from google maps, for instance, and just specify where you want to do a test latitude and longitude values. And then I’m going to click save. And so this is what a geolocation field looks like in salesforce. In the details side of things, you can leverage this information for or mobile app functionality. For instance, you can tie this in to beacons and do marketing through the marketing cloud. There’s a lot of cool things you can do with geolocation fields. The primary goals with this lecture at least, is that you know that geolocation fields are supported by salesforce and that you can enter longitude and latitude values and tie that with a record. So next we’re going to be creating.
- Creating a Custom Object and Number Fields Using the Schema Builder
Okay, in this lecture, we’re going to create another custom object. And then on that object, we’re going to create a couple of number fields. It’s time to extend out the app that we’re building throughout this course. And so the next object we’re going to be creating is a custom object that we’re going to call Episode. Now, Episode has to do with TV shows. If you recall previous, obviously we created an object called production. This is intended to capture movies, but also TV shows and as well, video games. So if you’ve ever been on IMDb, one of the things that will provide a challenge for our app would be for TV shows that there’s individual episodes. And so we need a way to capture those individual episodes because not all actors appear in all episodes. For instance, whereas a movie is a standalone production and they’re individual in nature.
So we don’t have episodes of movies, but we will need episodes for TV shows. And so I want to pull up the Schema Builder from here by clicking the Schema Builder button at the top right. And then I’m going to clear all and then I’m just going to select the objects related to our app so far, which would be production, person and production position. So right now we don’t have these objects related to one another. We’ve got production, production position, and person, as I mentioned previously. And so later in later lectures, we will be relating these together as we get into Master Detail relationships. But I actually want to create another object and this one would be Episode. And this Episode object will be in a Master Detail relationship with production.
But for now, we want to create this new object. So we could actually go into the setup menu and create this new object. But I’m going to go ahead and create this new object in the Schema Builder to change things up a little bit and help us visualize where things lie as far as our IMDb clone app that we’re building. So I click on the Elements tab in the Schema Builder. You see that this first selection here is an object and you can actually drag and drop these to create new objects. So I’m going to drag this onto the canvas and then give us a label called Episode, and then the plural would be Episodes. And this one starts with a vowel and this would be the API name. Enter a description. And then I’m just going to leave the default for the context sensitive help to just do the standard salesforce. com help and training window.
So we’re just going to leave the default of Episode name and a dated type of text. You could do auto numbering, but I’m just going to go with text because a lot of times TV shows will give titles or names to each episode. And so I’m going to capture that information here. I am going to allow reports activities track field history. I’m not going to make this available for the Customer Portal, and I’m going to set this to Deployed. Click Save. So now we have our new object called Episode. Later on in this course, we will start building out the relationships between these objects and have them enter into Master Detail relationships. But for now, we want to create a new field. And I mentioned previously, we’re going to create some number fields. So if you think about an episode of a TV show or even a TV series, these different people appear on a certain number of episodes.
So on the episode object, I want to add a number field. And so you notice over here in the Schema Builder under the Elements tab, once again I can drag and drop a number field into this object. And for this number field, there’s a couple of different numbers that we’re going to create on the episode object. One is the episode number and the other one is the season number. So we’re going to say episode number and this is a number field. And then on this one, I’m just going to copy and paste the same thing. For the description and the help text, you can enter a default value, which I’m not going to do. You could do a length. I think 18 is excessive.
We’ll just allow for up to 9999 episodes and not have any decimal places. By giving a length of four digits to the left of the decimal point and zero to the right, we’re not going to make this required or unique or set it as an external ID and click Save. And so now we’ve got our episode object and we’ve got our episode number. And that’s a custom field. You see the underscore underscore C? The data type is number four digits to the left of the decimal place and zero to the right. So now for the other number field, I’m going to go into the setup menu to create it rather than doing it in The Schema Builder. We’ll be getting much more in depth in The Schema Builder later on, but we want to stay focused on creating another number field and realizing the experience a little more fully.
So if I go to the Object Manager, or actually I can just click on the Episode custom Object definition here from my most recently used items that display. And so here’s our new custom object that we created in the Schema Builder. And you can see it now from the Lightning experience, the object detail for the custom object of episode. So we go to Fields and Relationships and we want to create another number field. So we did episode number previously. For this number field, we want to specify season number, then click Next. I’m just going to label this season.
So even the longest running TV shows don’t run for 100 years that I’m aware of because TV hasn’t been around that long yet, but let’s be forward thinking. And potentially in the future some show will go into three digits. So we’re going to allow for a three digit link. We’re not going to allow for anything on the right side of the decimal and then we’re not going to check any of these or do a default and click Next. Now I’m just going to leave the defaults for the Visibility per profile and make it editable by not checking the Read Only column. Click Next and then we’re going to add this to the Episode layout and click Save. So now we’ve created an object called Episode and we’ve added a couple of number fields. So let’s click down here and you notice that Episodes are not available from the drop down here. So in going through the schema builder, I didn’t specify adding a tab or go through the tab wizard when I created the object and so it’s not available here.
So if I go to Salesforce Classic, I’m going to select Switch to Salesforce Classic and we’re going to click on the plus sign by all tabs and see if we can get to it here. As you can see, there’s no tab for Episodes. So what I could do is click Set Up and go to Tab and create the tab manually here. So for my custom objects, I’ve got a tab for persons, production positions, and productions. I want to go ahead and create a custom object tab for Episodes. So I’m going to select Episode from the drop down and select the tab here. And this is an individual episode of a TV show. I’m just going to do a stopwatch. A lot of times it’s really hard to decide what you should choose for a tab style, enter Description and click Next. And then I’m going to apply one tab visibility to all profiles and just leave that to default on click Next and I’m going to include this in the Sales application.
Now, later we’re going to be creating the IMDb clone app from the drop down here, but right now it’s not there. But we will create that app and include these tabs to the IMDb clone app later. But for now we’re just going to include it in the Sales application because that’s the one that we’re on currently. I want to show you how to get to this tab. And so it’s in essence been added down on the tail end here. If we were enlightening experience, we’re clicking the plus sign and now we can get to Episodes. You notice it’s this link here. So if I click on Episodes, there are no episodes that have been created. There’s been no records. I created the custom object, but we’ve not created any records. If I click New Episode right now, I’ve got an Episode name and then also there’s this default currency which isn’t really relevant. And in a previous lecture I set my default currency to British pounds. And so as an end user, whatever your default currency is set to, that’s what these custom objects will just default to in case there is revenue attached to it.
And usually that just comes into play more with opportunities. But I need to change the page layout here, which will do that later to remove currency because we don’t need that. But I just want to provide an example of the episode name, which is a required field because the name field is required on all objects. And so I’m just going to give this episode name. Pilot it’s the first episode and it’s in season one. Clicking Save. Now, this has not obviously been associated with a TV show or with people, and that TV show would be a type of production. And so later on we’re going to begin to record types where we’ll specify between TV shows and video games and movies.
And we’ll also be tying in people to these productions and these TV shows. And so with this episode, this is an individual episode of a TV show, so you can begin to see how things can grow complex and hard to keep track of and how objects relate. You’re starting to understand now how The Schema Builder is helpful in quickly adding fields and visualizing relationships between objects as well. And so we’ve done a lot in this lecture. Not only did we create a couple of number fields, but we created a custom object. And we did that in The Schema builder. And so now that we’re familiar with creating number fields, we’re next going to learn how to create percentage.
- Creating a Percent Field
Now we’re going to create a percentage field. So if I go into the Object Manager and I’m going to access the Opportunity object, and this is a standard object in salesforce, I’m going to go to the Fields and Relationships area and then click New to create a new field. And for this field we’re creating a percentage field. And so you look for percent. So one thing to specify here, and it’s noted in the description on the right, it says that it allows users to enter a percentage number, for example ten, and automatically adds the percent sign to the number.
So you don’t have to enter zero one to get 10%, you just enter ten in the field and it’ll add the percentage for you. So click next. And so for this custom percentage field on the Opportunity object, I’m going to create a percentage field called discount. And so we’re wanting to give a discount, but we want to give less than 100%. And so we’re going to do a percent field with a length of two and we’re going to allow a decimal place of up to two to the right of the decimal point. So you could do for example, 99. 99% discount. And so if you wanted to further restrict the ability of your reps to discount things too deeply, you could do a validation rule on this percent field to limit that to a discount, maxing out at 20%, for example. But for now we’re leaving that wide open up to 99. 99 with the two to the left and the two to the right of the decimal point. So then you can provide help text or description if you would like. But we’re going to leave all this blank for now and just click Next.
And we’re going to accept the defaults for the profiles and make this an editable field by making it unchecked on the read only. And then we’re going to add this to all the different Opportunity page layouts that are available in our salesforce organization and click Save. And now if we go to an opportunity and we go to the Details tab, we find the discount custom field here so I can double click in there to enter in a percentage amount.
And as I mentioned previously, I’m going to do a 10% discount. So click save. And so it displays by default the two digits to the left and the two to the right of the number that I entered in and it adds the percent sign at the end of it. Now, there’s no sort of calculations that I’ve tied into this to further reduce this amount. For instance, you could accomplish that through formula fields or field updates, but I wanted to at least show you how to create a percentage. Sent filled. And so now we’re going to be learning next how to create a phone filled.
- Creating a Phone Field
So now we’re going to create a phone field. And to do this, I’m going to create a new custom phone field on the Account Object. And so I’m on an account that we created previously called ABC Corp. And if you go to the Details tab of this, you see a phone number filled here and a fax number. And so for an example of another phone number that we may want to capture on an account would be to capture capture their toll free number, for example.
And so I’m going to go to the Setup menu and I’m going to access Objects and Fields and get to the Object Manager and select Account. And then I’m going to go to Fields and Relationships and I’m going to click New. And so now I’m creating a new custom field on the Account, and it’s going to be a phone number field. So if I select Phone, it will allow users to enter a phone number and it automatically formats it as a phone number. So if I scroll down and click Next, and then for this, I’m going to enter in toll free, then click Next, and then I’m going to accept the defaults and add it to the page layouts and click Save. So now if I revisit the ABC Corp. Account by clicking here and selecting from the Recent items, if I go to the Details screen, I’m not seeing the toll free field in the page laps. I’m going to try to refresh and see if we can pull up the toll free number that I just added.
And as I mentioned in previous lectures, this seems to be a display issue in some browsers with lighting. Experience is when you add a new field, it doesn’t automatically show in the page layout. And so here’s the toll free field I’m going to enter in a toll free phone number, and I’ll show you how it formats. Then I’m going to click save.
And as you notice, it is automatically formatted this in the phone number format. And so if you integrate Salesforce with a soft phone software to where you can call from your computer by just simply clicking on this link and calling through a headset, it’s important for these numbers to be formatted like a valid phone number. You can do further validation rules. Since this is a toll free field, we could add a validation rule to validate this particular first three digits of this number.
Start with an 80 zero or eight eight, or whatever the toll free prefix may be in your own country may differ, and I’m just referring to United States examples. But for now, we’re just going to leave this as an additional phone field. And you could edit the page layout here if you wanted to in order to drag the phone numbers all in one section together. It is separated right now. But now we’ve covered how to create a phone field. We’ll next get into creating a picklist field.