Salesforce Certified Platform App Builder – 3 – Data Modeling and Management Part 8
- Relationship Types and Implications on Reporting
Okay, so now we’re going to talk about relationship types and implications on reporting. And we’re back on the same help topic here of considerations for relationships. If you scroll down towards the bottom of that page there’s the section for Impact of Relationships on Reports. So there’s a lot of good information here as far as how relationship types impact reports. I encourage you to read this more full and as you work through this course, experiment with different report types and see what you can and can’t do. But some of the main things to keep in mind is that the type of relationship you create affects which standard report types are available and how they are categorized. So for example, Lookup Relationships allow data from the two related objects to be joined in one report.
Master Detail Relationships allow data from three objects to be joined in one report and that would be the Master Object, the Detail Object plus one other Lookup Object. And then when you deal with many to many relationships, also known as Junction Objects, which we’ll be doing later in this section of this course, that provides two standard report types that join the Master Objects and the Junction Object. And so this table here is also helpful as far as the reporting impact of each relationship type. And it’s summarized in this table here. And that’s between lookup or master detail or many to many which is also junction object.
And so this gives you the standard Report types and the Report Type category. I wouldn’t worry so much about the Report Type category, but the Standard Report types. You’ll begin to see some of this come into play if you look at or explore some of these different scenarios as you’re building a report. And so I want to just briefly go into the Reports and show you some of this exemplified and then we’ll move on. So I’m going to get out of the schema builder and click set up. And so if we go to Reports, for example, and we navigate to the Account and Contact Reports folder, you notice that this doesn’t just say Account, but Account and Contacts.
That’s because there’s a relationship between Contacts and Accounts. And so if we were to do a new report, for example, and selecting the same Account and Contacts folder, we can expand this to see the different types of relationships can be brought into Reports. So we have one for Accounts just by itself. Then we also have this option here for Contacts and Accounts or Accounts with Partners, accounts with Account Teams, accounts with Contact Roles, accounts with Assets. And that’s because Accounts have these different relationships with these other objects. So if we were to go back to our Schema Builder and once again that’s accessed through Setup and let’s go over to Accounts.
Let’s zoom out though to see what we’re looking at. I’m going to hide opportunity to get it out of the way by unchecking the checkbox for it. And so if you recall if I hover over here, that Contact is a Lookup relationship to account. If you recall back when we were looking at the report options, we had the option of just having a report for account by itself, or there was a report type available to us in that folder to create a report that was contacts with an account. And so there’s Considerations for Relationships as it relates to reports you see under the Lookup relationship type, which that would relate for the example we just showed.
With Contacts and Accounts, you can have a report for an object by itself and that was where we saw just the account object by itself or an object with its first lookup. And so that was the type of contacts with an account. And so you can begin to see through this information here that the relationship types have some far reaching implications as far as the different types of reports that you can create. And so I do encourage you to explore this help topic more fully. And once again, that is the topic called Considerations for Relationships and I will make that available once again in this lecture as I did in the previous two. So next we’re going to discuss mass deleting.
- Mass Delete Records
So there’s different ways that you can mass delete records in Salesforce. And so if you go to setup and search for the term Mass, you can see various operations you can perform on data in mass. The first selection there is to mass delete records. And then as well, there’s other options as far as transferring approval requests, transferring records and updating the addresses. But we’re dealing with deleting records, so I’m going to click on that. And so there’s certain object records and these would be standard objects that you can mass delete and those would be Accounts, Leads, Activities, Contacts, Cases, Solutions, Products and Reports. You can click on one of these to then go through and mass delete the records associated with Accounts or whatever object you choose to click on.
So when you do a mass delete through the interface, there’s different steps that you need to follow here. And the first is reviewing what will happen when you mass delete whatever object records you selected. And in this example, I selected accounts. It’s telling you that if you delete these accounts, it’ll also delete any account notes. It’ll also delete all contacts associated to this account plus all related contact data, all opportunities on Accounts and all activities associated with Accounts. Once Data is deleted, it will be moved to the Recycle Bin. And then there’s step two here recommendation prior to mass deleting. And what they’re recommending is that you run a report before you do a mass delete so that you have a copy or an archive that then if you decide you need to restore some or all of that data, you could do that, like through the data loader, for instance, or the Data Import Wizard. This data will be in your Recycle bin for up to 15 days.
But if you decide you need to restore something that has been deleted after those 15 days, you’ll be out of luck unless you’ve performed a backup or an archive of some sort, which can be done through a report and then just saving it somewhere. Another way that you can get this backup is where they’re saying it’s strongly advised to request and receive a weekly export of your data before running mass delete. Now, bear in mind, we looked at this data export functionality in our Free Salesforce account earlier, in an earlier lecture, and that is limited to a monthly export in the Free Developer Accounts. But in enterprise organizations you can have that frequency set up to a weekly export.
And there’s further notes on this here as far as how that is available in the Enterprise Edition and then it’s also available for an additional cost with the Professional Edition of Salesforce. So now you can set your criteria to find the accounts that match that you would then subsequently delete. And so if you want, you could narrow your search down or you can just click Search and then the bottom of the screen updates with the search results to which you could select a specific account or accounts and then select Delete by clicking the Delete button. I do want to scroll back up to revisit some of these other upper portions of the screen beyond the filters. Here in step three we have step four. You can choose to delete accounts with closed one opportunities.
So you may have an instance where you’re thinking you want to delete an account, and that account may historically have some closed opportunities that have been won. And if you don’t check this box, then you’ll be blocked from deleting those accounts. But if you check this, it will go ahead and delete not only the account, but any closed one opportunities. And then you can choose to delete accounts with another owner’s opportunities. If you do this, you will be able to delete the account even though someone else may own opportunities that are associated with that account. And so then as well, you can select to permanently delete the selected records. When you select this option, you cannot restore deleted records from the Recycle Bin.
Please be careful when selecting this option. So I’m not going to do that. So I’m going to go ahead and delete these two accounts that I’ve checked just to show you what this looks like. And then we’ll go in the Recycle Bin and restore them because I don’t want to actually lose them, but I want to show you what this is like. So I click Delete, and so now the screen refreshes and those two accounts are gone. So if I go to my recycle bin and unfortunately, you can’t access the recycle bin from lightning experience. So I need to switch back to salesforce. Classic. Just click Switch to Salesforce Classic and then if you remember, the home screen is available from Classic only. Right now from your home screen, this link here on the bottom left for Recycle Bin.
And so one of those accounts actually deleted, the other one did not, probably because there was some opportunity associated with it that was closed one. So I’m going to select that and select Undelete, and then that will restore the S Force account back to my instance. So then another thing I want to show you, and this is where mass deletion of records may come into play, is the company information screen again. And so you may want to mass delete records if you’re running out of used dataspace. I’m on my company information screen and setup, which this is available in Lightning Experience as well. I’m just clicking over in Classic because I was already there.
And you notice this field here, used data space. This has to do with the data space that is used up by the records in your Salesforce instance. The used file space has to do with things such as attachments and images, but the used data space would be for each individual account record. For instance, those take up a certain amount of space in your and you see the amount here is 308. That’s 6% of the total available to me. Salesforce does make this space really limited for the free developer accounts.
And that’s to prevent you from running a full production instance for your business for too long, because eventually you’re going to run out of space and then you’ll need to pay up. In order to fully realize the functionality of Salesforce, I’m going to click View by use data space. And so the different types of data space used here, it shows the number of opportunities and there’s 31 in the space that that’s using down here on accounts.
There’s 14, for example, and it’s 28, it’s 9% of the total space I’ve used. And then as well, here’s the limits for data storage and file storage. So you see that in my instance, I’ve got five megabytes of space for my data storage, which is not much at all. File storage is 20 megabytes. So this top part here, the screen is the current data storage usage. And then also we have the information around the file storage, which if you scroll down, you can get more details on that.
I’m not sure what this content is here. That’s just one record that denotes two bites of information. I have no idea what that would be. But there’s also two photos in my Salesforce instance and they take up 13 KB. So Photos would take up file storage and then individual records for the different objects take out the data storage. And so I show that just to remind you of the company information screen, which has a lot of useful information. And so as you’re developing or administering on the Salesforce platform, you may hit instances where you’re getting close to running out of space and you need to perform a mass delete. So I wanted to show you why you would be doing a mass delete. Otherwise you would just probably want to keep all your records forever and not worry about it.
And so then another way that you can do a mass delete beyond the one that we did in the setup menu is you could create a report and it grabbed the Salesforce IDs for different records and then use the data loader to perform a delete in mass. And so, for example, let’s click on the New Report button and create an account report. And we looked at previously the different report types based on relationships in a previous lecture and the implications on reporting. And one of those things had to do with just the object itself. And so I’m going to do a report of just that, of just the object itself and not bring in any contact information.
But I’m going to pull up and create a report that pulls in all of our accounts. And so I’m going to change this date field created Date. Instead of a custom range to all time, and I’m going to select all accounts instead of just my accounts. And then the main thing to keep in mind here is a lot of these things I don’t need for my report. If I’m doing a mass delete, the main thing that I want to get to in order to have the data that I need to do a mass delete through the data loader is just the account ID. And so I searched for the term ID on the left here, and the matching results are Parent Account ID and then just Account ID. I’m going to drag this over. This gives me the salesforce unique ID for each of these accounts. So I’m going to run this report now. I’m going to export the details, and I’m going to save this as a CSV file. And I’m going to click export. And you’ve see the records here for the CSV file.
Now I’m going to click done. And now I’m going to go to my data loader, and I’ll show you how to do a delete in the data loader. This is pretty cool. So I’ve got my data loader on the desktop here. Going to double click that. I’m going to go ahead and maximize this to fill up the screen. And so in the data loader, when you want to do a delete, you just click on the delete button and you’ll be prompted to log in. So I’m going to log in. Once you’re logged into the data loader, after having clicked Delete, the screen refreshes to click Next on.
And now you want to select the object that you want to delete records from. And so I want to select Account because I did an export from a report for all my accounts, and I’m going to browse to my CSV file that I saved locally to my machine. And so once you’ve browsed and selected the location for the CSV file, you click Next. And then in the next screen that pops up, it shows that this operation will contain 14 records. I’m going to click okay. Now the data loader reads the CSV file and determines the different column headers, which are here on the left, the Account ID and the account name. I’m going to click Create or Edit a Map, and I’m going to drag the ID field down to the Account ID file column. And this would be the column header in my CSV file.
Now I don’t need to worry about the account name for a delete. If you notice, the only field for me to match with the ID because the data loader, all it needs is the ID in order to know what accounts in this example need to be deleted. So I’m going to go ahead and try to delete all my accounts. Some of these may be blocked because of relationships with other records, such as closed one opportunities. I’m just going to click OK, and it shows here my current field mapping of the ID. And this account name appears because that is another column in my source CSV file that I just don’t need. Then I’m going to click next, and then the directory where my success and error files will be saved is here. And so I could change that if I wanted to by browsing or entering in a path here.
And then when I click Finish, I’m going to confirm that I do want to delete these account records. And let’s just see what happens. So here it’s warning that your recycle bin is limited in nature, and so if you exceed your recycle bin limit, you will not be able to recover these records from your recycle bin. Potentially. I don’t think we’re dealing with that large of a set of records, and so I’m going to go ahead and click yes. But if you feel uncomfortable doing that, you don’t need to necessarily follow along. And please don’t delete account records in your own work environment.
If you’re following along in a production environment or even a sandbox environment, if you’re working in your work related instance, this would be only if you’re in the free developer account that we signed up for in this course. Please clicking yes. It’s loading the delete, and it says that there were five successful deletes and nine errors. So I’m going to view the successes. And so these are the five accounts that were deleted successfully. And you see Dickinson s Force, Pyramid XYZ and ABC. And I presume that’s because they don’t have any closed one opportunities, let’s see the errors and see why they failed. And so here’s the ones that failed.
And if you look at the error column, it’s in. Your attempt to delete this account could not be completed because it is associated with the following cases. So this is because there’s case associations, and so the data loader can do mass deletes, but it can’t handle if there’s associations with cases and there’s other relationships that it can handle.
And it shows the case numbers actually for these different cases. So you could then clean up those relationships or repair those records, potentially. I’m not sure that you can read parent cases to different accounts, but this at least gives you further guidance on why you can or can’t delete a certain record. Now that we’ve discussed mass deleting of records, it’s now time to discuss external.
- Introducing External Objects and External Data Sources
Introducing external objects and external data sources. So if you search for the term external and setup, you’ll see a few options here under the Data menu and that’s External Data Sources and External Objects. So if I click on External Objects, you come to the External Objects screen to where you can create a new external object, which we’ll be getting into more in the next lecture. But I wanted to show you what external objects are about. And so here on this screen it says that you use external objects to virtually represent external data as Salesforce objects.
External Objects map to a table in a data source outside the Salesforce. org and enable access to that data via custom tabs and search. Each external object requires an external data source definition for connection details. So if I click on the External Data Source link, it brings me to the External Data Sources page, which is the same as if I were to click here in the menu. And it’s here that we access data in other Salesforce organizations as well as third party databases and content systems. And so we’re going to be diving into creating external data sources and external objects.
And the way that I’ve chosen to do that is to leverage a tutorial that Salesforce has put out that I feel like is really good at walking you through the various steps of creating external data sources and external objects. And that particular tutorial is here. I’ve got this open in this tab and it’s on Developer force GitHub IO. And I will make the full link to this tutorial available in the Resources section of this lecture. And I’ll probably make it available in the next lecture as well. But I wanted to give you a preview of what we’ll be working through in the next lecture to explain where you basically need to start. Because in this tutorial it gives you an overview. And I do recommend that you read this and it tells you the broad overview of what all you’re going to do in this tutorial. If you scroll down, it tells you what you will learn in the browser requirements and the issues.
So after you’ve reviewed all that, go ahead and click Next and then you can skip this first module here, which is creating a Developer Edition account because you’ve already created a Developer Edition by signing up for one. And you’ve been working through various lectures in this course. I’ve already verified as well that by completing this tutorial and installing the things that they have, you install and setting up and configuring the external data sources, that it’s not going to conflict with our own apps that we’re going to be building throughout the span of this course.
And so I want you to go ahead and work through these in the same Salesforce organization, which would be the free developer account that you sign up for. Don’t do this in a workplace environment, but do this in a free developer account. So you should already have your free developer account already set up and going. And so you can click Next here in this tutorial. And it is here that we’ll pick back up in the next lecture where we’re installing the Schema package. And so meet me on the other side in the next lecture as we start out by clicking here. And we’ll be completing together a helpful practice activity of creating an external object and an external data source.