Practice Exams:

Salesforce Certified Platform App Builder – 3 – Data Modeling and Management Part 7

  1. Exporting Data from Salesforce

Data from salesforce. And so the most obvious tool to use for this would be the data loader, which I have opened here. And I wanted to show you specifically these two buttons which are Export and Export All. So we previously clicked on the Export button to export some data out of salesforce using the data loader. And that was on the lecture related to importing data. We use an export as our starting point pointer template and then did some data manipulation in our source file and then imported that. And so now, since we’ve already looked at briefly how to export, I want to highlight the Export All button. The only difference between these two is that the Export All functionality enables you to not only export records from salesforce, but also to export any deleted records that reside in your recycle bin. And so if you’re wanting to pull out, for instance, all contact records, even those that you’ve recently deleted, you would use Export all instead of export.

So I’m going to show you how to do that via the data loader here by clicking Export All. And so in our example, we’re wanting to export all contact records, even those that have been deleted and are currently residing in your recycle bin. And so you choose a target for your extraction. I’m just going to leave that the default of Extract CSV. But you could browse and locate the folder that you want to export your data to and you can even name this something different, for instance, and then click Next, and then click yes to confirm that you’re wanting to perform an export. And then you can start to form your soccer query by checking the checkboxes on the left here. Then once again, you can resize the window to give more room for your where clauses. And so I’m selecting the ID for the contact, and I also want to select the account ID for the corresponding contact, meaning the account that they belong to. And then as well their first name and last name.

Let me go ahead and pull in the name as well. That’s a combination of the first name and last name and the salutation. That’s where the Mr. Or Mrs. Will come from. And then I’m looking for as well as the Is deleted flag. That’s the flag to show if something’s been deleted or not. And then as well, I want to pull in a custom field that we previously created for the Social Security number, for example. And now I want to create my where clauses. I wanted to just export contact records that have been deleted and are in the recycle bin. I could do a where clause that says is deleted equals true. And I’m going to add that condition and I’m going to copy this because I’m going to do another one here in a moment. So I’m going to command C and then click Finish and you notice it says that I’m selecting the ID, the is deleted flag the account ID, last name, first name, Salutation, and then the name and Social Security number custom field from contact where is deleted equals true. So I’m going to click yes to proceed. And then once the operation completes, it shows that there’s zero successful extractions and zero errors. And so I’ve not deleted any contact records.

So I’m going to click View Extraction here and you see that there’s none. And so I’m going to click OK, I’m going to do an export all again and select Contact and then next and then yes to confirm. Then I’m going to generate my soccer query here. I’m going to say where is deleted equals false and click Finish and yes to confirm. And now I’ve got 20 successful extractions. I view the extractions, you see the contact ID and you notice the three character prefix of zero zero three for each of these records here. That’s because those are contact records which are standard object. And all of those will always have a zero zero three for the three digit prefix for their 18 character or 15 character ID for that matter. And then the account IDs are zero zero one prefixes. These first three characters of accounts, I’ll start with zero zero one. And then scrolling to the right, I see the last name, first name, the salutation. And then we see the Name field which combines the first and last name. This is a helpful functionality of salesforce is that it provides you the Name field as well.

And then we see Arthur Song with his Social Security number that we entered previously. To further demonstrate this, I’m going to delete the Jake Lorac record, search for Jake and we find Mr. Jake Lorac. That’s a salutation there. The filled salutation on a contact gives the designation to Mr. Mrs, miss, et cetera. I’m going to click on him. I’m going to delete Jake Lorac and I’m going to show you where he resides in the recycle bin. If I click on the recycle bin, it defaults to my recycle bin. So I’ve just deleted Jake Lorac and here’s the date and time of that action. So now if I return to the data loader and so let’s click Export All and then select Contact. And then next I’m going to replace the existing file of extract CSV. I’m going to select the ID, the last name, first name, salutation name and is deleted. Let’s go ahead and grab the account ID as well.

And then I want to expand my window here to form my where clause. Where is deleted equals true. Then click finish and proceed. Now we’ve got our one success. Now so we can view the extraction and we can see Mr. Jake Lorak who is deleted equals true. And so you can pull in things out of the recycle bin through Export All, but not through Export. Let’s try that now and put that to the test by selecting Contact. After having clicked the Export button, we’re going to see if we can get to Jake because he’s in the Recycle bin. So I’m going to click Next and yes and I’m going to select ID and is deleted and let’s just select the name filled so we know who we’re dealing with. And then we want to do the Where clause where is deleted equals true again, add the condition and click Finish then yes. And so I’ve just confirmed that you cannot pull in data out of the Recycle bin when you just click on Export.

And so that’s a good demonstration for you of what the difference is between Export and export all. So another way that you can export data out of salesforce is by way of a report. And so I’ve gone to the Reports tab, I’m going to click on the Account and contact Reports and then I’m going to select an account report. What I’m selecting is a standard report that’s out of the box with your Salesforce instance and it’s called Accounts with last activity greater than 30 days. And so I’m going to change the Last activity range from Custom to all time in this updates to show these are the different accounts that I’ve not done any updates on for a while.

So I click run report. Now that I’ve got some data to work with, you notice the Export Details button appears on the report. So you can export data from salesforce by generating a report. So you just click on Export Details gives you the option for setting the filing coding from the drop down here. I usually keep that to default for myself and then Export format of CSV or XLS and then you can simply click Export and then that saves an Excel or CSV file to your downloads folder that you can then open and manipulate the data accordingly. So here’s that Export in Excel and it shows each record is a single row on this spreadsheet and so this gives you a visual representation of what these exports look like as well. So when you have these exports from Excel it gives you the filter capability for these different columns so that you can filter and select or Deselect for instance. And you notice that the display updates accordingly. And then it also gives you the reference of the name of the report that you generated and gives a copyright information and the date that is generated by whom and the company name. So this is another way that you can export data out of salesforce is via Report which is very helpful. So I’m going to close that out and return to Salesforce now. Not going to bother to save that. So now I’m back in salesforce and back to my Export screen for my report and so I’m going to click Done on that to return back to my report. So then another core functionality when it comes to exporting from Salesforce is accessible via the Setup menu. So if you search for the word Export, there’s the Data Export option under Data Management.

So if you click on that this is a monthly export service. Now it’s monthly in the Free Developer accounts that we’re working in, in an enterprise level or above instance of salesforce. This is a weekly option. But Salesforce does not provide daily exports of your data records. They should, but they don’t. There are third party tools that you can use to do this, or you could use the data loader and schedule jobs daily to do your exports if you wish. But for now, one of the other core functionalities with the data export though, is you can do a scheduled monthly export in the Free Developer account or weekly out of the other instances of salesforce. So you schedule the export, you can specify the file encoding, you can specify to include images, documents and attachments by clicking here. That will increase the file size and the processing speed of such requests.

You can also include Salesforce Files and Salesforce CRM Content document versions that has to do with libraries and Salesforce content and also will increase the size if you select that. You can also replace Carriage returns with Spaces and you can leave that check to default. So you can set the frequency either to specific day of the month or on the first, 2nd, third or fourth specific or last specific day of the week of the month. So if you want to do an export for the last Sunday of every month, then you would do that like this. You specify the start and end times for this data export. And so you can set this well into the future if you wish. You can specify a preferred start time and then click Save and that schedules your data export. So this shows your next scheduled export. Or if you wish, you can click Export Now to go ahead and do an export right away.

And you can also do the same designations of what to include or exclude and then it’s defaulted to exporting. All data you notice here include All Data is checked. If I uncheck that, I could just export specific objects if I wish, but I want to select to export all data and this will export all the data records for each of these objects in my instance. And there’s a lot of these, a lot of these are default objects that are available in your Salesforce instance. And then some of these are related to the apps that we’ve installed, such as this currency app called S 4G that we did in a previous lecture. So once you’re done specifying what objects you want to export data for, you just click Start Export and then eventually you will get an email saying that your export is ready.

So then when you come back to the Data export screen, it will show not only your schedule to export, but it will have a download link where you can download the CSV file. That CSV file will actually be a large zip file. And then contained inside of that compressed zip file are individual CSV files for each object and any records for each of those objects will be in those individual CSV files. Another tool I want to show is the Workbench. The Workbench is available from Workbench Developerforce. com and so you want to agree to the terms of service and the environment is production. And then you can select the API version. The API version has to do with the three annual major releases that Salesforce does. And at the time of this recording, we’re on API version 37.

And so you could actually log in using a different API version to be able to test out functionality for old historic versions of Salesforce. But we’re just going to keep things current and click Login with Salesforce. This will authenticate us against the instance that we’re currently logged into, which is my Salesforce. org that we’ve been working in. And you can actually jump to different menu options. So as you can see in the Workbench, there’s a lot of different functions available such as standard and custom objects. You can choose an object to see a further description on it, so you can get details on the Account object here and get really in depth on the developer side of things and see all the different details that are very deep level on an object.

But what I want to show is a soccer query. So what the workbench can do is it can give you the ability to export data or at least do a sockle query and get the results to then work with those through various means. And so if you notice here I’m on the Account object, let’s instead select the contact object. We can view the cycle query results as a list, a matrix, a bulk CSV or bulk XML or the format of the return results. And you can also include or exclude deleted and archived records, meaning you can get to things that have been deleted and are currently residing in the recycle bin. And you can even as an admin see things that other people have deleted.

And so we want to pull in the fields on the contact record for is Deleted and ID. And you need to shift or control click to specify these individually. Or you can actually type in here. Let me see if I still have my soccer query for my clipboard, which I do. So I’m going to use that same soccer query actually that we did previously in this lecture when we’re looking at the data loader. But I’m going to do this now in the workbench and I’ve specified to include deleted and archived items. I’m going to click Query and I’ve got the one record here with the idea of the contact, which you can actually choose some actions from this by hovering over, such as viewing in Salesforce, which is pretty nice. You can undelete from here even. You could delete or purge to remove it from the recycle bin. Or you can go to the update screen to update this record. And then we’ve got the account ID, last name, first name, Salutation name, and the empty Social Security number field.

Let’s change this though to get more data to work with. Let’s just remove the where clause so that we pull in those that are deleted and those that are not all in one fell swoop. So clicking query, we should get the 20 results which we do and we see is deleted is true for Jake Lorac here, but the rest are false. You could then work with this data further from within the workbench where you could copy it and paste it into Excel or save it as a CSV. So bear in mind the workbench when it comes to exporting data as well that may appear on your exam as far as just knowing the different capabilities of exporting data. So let’s return back to Salesforce now.

You may encounter questions on the exam related to the different ways you can export data or manipulate data in Salesforce. And so if you just bear in mind that there’s the data export functionality under Data Management, where you can export all records on either a weekly or monthly basis, you can use the workbench. You can also export data from Salesforce reports. And so then as well, if you’re ever tasked with importing records in Salesforce, the best way to get a good starting template to work with is to first perform an export. And that gives you the column headers with the field names so that they match up for an easier import other side. So in the next lecture we’re going to be talking about relationship types and implications on record access.

  1. Relationship Types and Implications on Record Access

So now we’re going to deal with relationship types and implications on record access. And in the Exam guide they expect you to understand not only the implications on record access, but also user interface and reporting when you deal with relationship types and implications. So these are really deep subjects that we can’t really address in the span of this lecture, plus the next two full fully and you will grow to understand these concepts more as you progress through this course. And so I wanted to take a brief moment though to revisit The Schema Builder and talk a little bit about relationship types to help layer on more understanding around these topics for you if you’re new to object oriented principles and then split up those three requirements from the Exam guide.

And so this lecture will be talking about record access and then the next lecture will deal with the user interface implications. And then in the following lecture we’ll deal with reporting implications as it relates to relationship types. So in The Schema Builder, I have a handful of objects open here and a few of these we created previously for our app that we’re building throughout the duration of this course. And so if you notice here, if I hover over this red line that says that it’s a master detail relationship from episode to production. And so if you recall, an episode is one single episode of a TV show, which is a type of production.

You really can see as you move this around how the line between the two objects adjust and remains. And so the convention here in The Schema Builder is these three small lines connecting to this object. That’s the child or the detail object in this relationship. And then here at the head or the top is the parent or master side of this relationship, this master detail relationship. And so then as well, if I move this over and I’m going to zoom out a little bit to help with visibility, I’ve got accounts, contacts and opportunities which are three standard objects that are related to one another. You notice here that there’s a master detail relationship on account that has to do with an account hierarchy field. And so, for example, if I were to scroll down until the foot of that branch there starts to move, you can see that the field name is called parent and that is a hierarchy field, which is a type of field that we’ll be getting into more later.

But that is a master detail relationship called parent and it is a master detail relationship up to the account. And so that has to do with account hierarchy. And if you had like a corporate headquarters for an account and then you had branches and you had those associated through an account hierarchy relationship, we have here a couple of lookup relationships. This one is a lookup relationship from contact to account. And since we have the three lines that we notice that the contact looks up to the account. Same thing for opportunity. It is a lookup relationship as well and it’s from opportunity to account. And so you look up to the account from the opportunity. So you just think of the opportunity as the child and the account as the parent.

And so based on the relationship types, there will be different impacts on record access. And so I want to make you aware of this particular help page which I will make available in the resources section of this lecture. And there’s considerations for relationships. And so I consider this more of a trivia type of page because there’s a lot of facts that would be helpful to remember. You’re not going to understand all these. It would be good to try to memorize some of these because they may appear on the exam, but as we work through this course and we set up more and more relationship types, this will begin to make more sense. So the end goal of this lecture is not to have you fully understand the relationship types and implications on record access, but to at least know where to go for more information and then to bounce this help page.

And this understanding of these details bounce off of this as you’re building out your apps that you’re building and you’ll begin to understand facts here, such as each custom object can have up to two Master Detail relationships and many lookup relationships. So there’s a high likelihood that this concept right here could be represented on the exam. And so a custom object can have up to two Master Detail relationships. So that is the maximum. But it can have many lookup relationships. I don’t know the limit, I’m sure there is a limit, but the main thing to keep in mind is that you can have three or more lookup relationships on a custom object, but only two Master Detail relationships.

And then as well, each relationship is included in the maximum number of custom fields allowed. So each object here, if we go back to the Schema builder, each object has a certain number limit of custom fields that you can create on them. And so as you add a field for a Master Detail relationship or a lookup relationship on an object, that counts against your limit on that object. And so then there’s also caveats and notes around converting relationships. And I’m not going to read every single piece of this help file, but I do encourage you to revisit it. You can tell that there’s a lot of detail here. And so I could literally probably do a course on all the ins and outs and intricacies of the different relationships that are available in salesforce and then the implications on record access, user interface and reporting. And we will be revisiting this help page and I’ll also be showing you a few others in the next couple of lectures as we deal more with user interface and then finally reporting implications. But suffice it to say that this is a deep well that you need to explore.

You can read this now if you so choose or you can mark it for later review if you wish, but there’s some good nuggets of information here that will not make sense to you until you run into them. And I’ve run into this one in particular. As far as trying to convert a lookup relationship to a master detail relationship, the main thing to keep in mind that when you do these conversions from one relationship type to another, there may be some potential gotchas and salesforce will block you from doing that. And in this example for each record in a lookup relationship, if you’re wanting to change that field to a master detail, then that lookup field needs to contain records or have a value in each record before you can convert that to a master detail relationship. There’s also self relationships and we showed this previously and that would be like an account hierarchy relationship and that’s a relationship unto itself. So the main thing to keep in mind here is that you do have the ability to create a relationship from one object to itself. So you could have account to account or contact looking up to another contact for example. They give you other good examples here in this section.

And then as well there’s notes around icons for customer related lists that will be more related to implications on the user interface and then there’s further notes on master detail relationships. And I cannot stress highly enough that you need to understand master detail relationships versus look up relationships and the implications and differences between the two. And so some of the important things to understand and this is confusing admittedly and just bearing in mind you’ll understand this more as you progress. But for example, this is a core point is that when you define a master detail relationship, the custom object on which you are working is the detail side. Its data can appear as a customer related list on page layouts for the other object.

So you establish master detail relationships from the detail side or on the child object. Another good point to keep in mind is this whole issue and implication of repairing of records and master detail relationships and the option of allowing repairing and master detail relationships. Another good note here is that standard objects can’t be on the detail side of a custom object in a master detail relationship. And so what that means is we have this production custom object here. If I wanted to try and make the account a child to a custom object production, I can’t do that. So as you can see there’s a lot of information here around relationship types and implications on record access and as you go deeper you get into many to many relationships that has to do with Junction Objects. We’ll be getting into Junction Objects more later.

You’ll want to visit these concepts here and then more details around, lookup, relationships and then as well, relationships on external objects. Even. I don’t think there’s going to be a lot on the exam related to external objects. There wasn’t back when I passed this exam, but that may have changed. And then in a couple of lectures we’ll be getting into the impact of relationships on reports. And so the main thing thing or the main takeaway here is just to prepare you for these particular concepts that you’ll need to understand more fully in order to approach questions on the exam related to relationship types and the further implications. We’ve talked enough now about record access. And so in the next lecture we’re going to talk more specifically around user interface implications as it relates to relationship.

  1. Relationship Types and Implications on User Interface

So now we’re going to talk about relationship types and implications on the user interface. And so I’m back in the Schema Builder and we’ve got a few custom and standard objects open here. And as it relates to relationship types and the user interface, depending on how objects are related to one another and the records that are contained in those objects, this will have an impact on the user interface. So in the previous this lecture we discussed the implications on record access and if you recall, we were looking at this long help page that is in the resources section of the previous lecture. And so then as well, I’ll make that available in this lecture as well in the Resources tab, along with another help page that we’ll get to here in a moment.

But one thing I wanted to highlight is this particular section has to do with the user interface impact as it relates to relationships. But I wanted to highlight as well this particular help page which I’ll also make available in the Resources section of this particular lecture. And this comes from the Soap API Developer Guide. This sort of information appeals to me more and I don’t know if it’s because it’s from developer documentation. This is not an online help page, but this is developer documentation. And so there’s a lot of good resources in this particular area of salesforce’s website as it relates to developer documentation. And the Soap API Developers Guide has more details around relationships you can see here and this is more presented in a developer standpoint. This may appeal to you more or may not, but I wanted to make this an option to make you aware of developer salesforce. com and the developer documentation.

But as this relates to the user interface, there’s some notes that get into that more here and you can see that you can define different types of relationships by creating custom relationship fields on an object. And then the differences between relationship types include how they handle data, deletion record ownership security and required fields in page layouts. And so the core point here as it relates to the UI or user interface, when you talk about and consider relationship types, is that it will have an impact on the required fields and page layouts. So when you see in the exam guide that it says you need to understand the relationship types and implications on user interface, one of the things it’s talking about would be the required fields on page layouts.

And so scrolling down you see here these different types of relationships. There’s master detail. And this one to end designation may be familiar to you as a developer, meaning that there’s one master record in any number of detail records or another way to refer to that as one parent, but it can have one or many child relationships. And so here these bullet points give you a lot of good details when for instance, a record of the master object is deleted and here it says its related detail records are also deleted. So something like that might be on your exam. So what I encourage you to do in your own salesforce instance is to try this out. You could create a master object and then detail objects and populate records around both and then try to delete one of the master records and see what happens to those detail records. This will make more sense as you get some hands on experience and try this out.

So I encourage you to experiment and get into your own salesforce. org and feel free to create additional objects just and call them throw away or delete or testing or whatever you want. But the key here is to follow up these lectures with going into your own and experimenting and testing out these items. Here in a record of the master object is deleted, its related detail records are also deleted. That is almost a sure bet that something like that will be on your exam because it’s so important to understand these implications for relationships. But as well as you scroll down the many to many relationship implications and this is what’s called junction objects and then finally look up relationships, it’s similar to master detail and it’s easy to get confused.

But the main thing to keep in mind between the two is that a lookup relationship that this type of relationship links two objects together but has no effect on deletion or security. Unlike master detail fields, lookup fields are not automatically required when you define a lookup relationship. Data from one object can appear as a customer related list on page layouts for the other object. So the other thing related to the user interface and the implications when you’re talking about relationship types is that the customer related list on page layouts will appear for the other object.

So to recap as we’re just talking about the user interface, the core things to keep in mind as it relates to relationship types and implications of the user interface is that you will need to understand the implications for the user interface because this will have an impact on what related lists are available on a page layout and then as well, they’ll have an impact on the icons for these related lists as well. And then additionally this will have to do with required fields on the page layouts as well. And so next we’re going to be talking about relationship types and implications on reports.