Salesforce Certified Platform App Builder – 5 – Business Logic and Process Automation Part 3
- Record Type Sample Exam Question #5 from the Exam Guide
Okay, so it’s that time again to look at another sample question from the Exam Guide. And in particular, this is question number five that you’ll find towards the end of the Exam Guide, which is available from the Resources section of lecture one of this course. And you can also search for by searching platform app Builder exam guide from Google. And so this particular question reads that Universal Containers needs to set the record type for converted leads, account contact and opportunity based on the user who is converting the lead. And it’s asking how would this be accomplished? And so if you were paying attention in the last lecture, you’ll probably be able to figure this out, but I’m going to go ahead and read these for sake of completeness.
So the first possible answer is to set the default record type for each profile for account contact and opportunity to the desired record type for converted records. The second option would be to set the default record types for each role for account contact and opportunity to the desired record type for converted records. Option C is to set the Master record types for each profile for account contact and opportunity to the desired record type for converted records. And then finally option D is to set the Master Record types for each role for account contact and opportunity to the desired Record type for converted records.
You notice here that you need to choose one answer. There’s only one answer that is correct. And that correct answer would be a to set the default record types for each profile for account contact and opportunity to the desired record type for converted records. You notice that a couple of other options that you can rule out are B and D that say to set the default record types for each role. And so here’s a good example of how Salesforce tries to determine if you know the difference between profiles and roles. So as you’re approaching questions on the exam, you can begin to start to at least hone in on the potential correct answers, knowing very quickly that this default record type is set at the profile level, not at the role level.
That really just leaves you with option number A or option number C on this question because they both are mentioning the profile. So really the only difference between A and C as you notice, is that A says set the default Record type and C has set the Master Record type. Now this is kind of a misleading question because it really just comes down to what the wording is in the interface. It says the default Record type, it doesn’t say the Master Record type. And so it’s very confusing as well because when we create new record types from the start, it’s based on a record type called Master. And so this is really trying to trip you up to see if you know the difference between the two and what it’s hinting at. And so the default record type would be that we saw previously when we were creating the different types of account record types. We had client and we had prospect and then as well, if you recall when we created the production record types for TV show, movie and video game.
And so you can set a default record type. And so I wanted to run through this sample exam question after having just done the assignment of the default record types and walked you through that exact scenario that is spelled out in question number five of the exam guide. And so if it doesn’t make sense or isn’t really clear, you feel free to revisit the previous lecture and walk through the lead conversion process in your own organization and see and test it out for yourself to see if the default record types carry over whenever you convert a lead over into an account operating Tunity and a contact record. And so now in the next lecture we’re going to get into picklist values and so stay tuned for creating picklist fields and record type implications.
- Creating Picklist Fields and Record Type Implications
So now we’re going to talk about creating Picklist fields and then the associated record type implications. And so I alluded to this previously whenever we were looking at the different types of record types that we created. And so if I go back to the Object Manager, for example, and select Account, and then if we click on the Record Types related list, we’ve got our two record types, we’ve got Prospect and we’ve got Client. Let’s click on the Client Record type, for example, and I’ll show you what these picklist values are about. And so we’re in the Client Record type for the Account object. And so down below on the details of this, there’s the picklists available for editing. Now each Record type you can specify different Picklist values based on the different record types. And so some of the picklist fields on the account record are account source, active customer priority, et cetera. So let’s click on the Edit link by Active and I’ll show you what we have here. We have yes and no for the values here. We want to leave those both in place for that particular Pick list.
And so other Pick lists are Rating, for example. So let’s just cancel out of that since that doesn’t really relate with clients. And so probably a good example would be if we were to go to Opportunities instead. So let’s go back to the Object Manager and let’s select the Opportunity Object and select the Opportunity Record types. We’ve got a service opportunity record type and a product record type. So let’s click on the service record type for opportunities. So for a service record type for opportunities, we could edit the delivery and installation status. And so let’s say that we want to remove yet to Begin, for example, from this particular Pick list value, let’s do a default of In Progress, click Save. And so now for example, that was the Delivery and Installation Status.
So if I were to go to an opportunity that has the Service Record types such as this one that we created previously during the Lead conversion process for Phyllis Cotton and Avid Insurance, then you’ll notice under the Details, if we double click here on this field, we only have in progress and completed available to us. Now, it’s not defaulting to In Progress because this is not a new opportunity that we just created. But you notice that the one other option for this Delivery and Installation Status isn’t available here. So I’m going to select in progress and click Save. Let’s go to a different Opportunity. So if I go to this Pyramid Emergency, for instance, and click on the Details tab, I can select for the Delivery Installation Status by double clicking and I see I’ve got In Progress completed, but also yet to Begin. And that’s because the Picklist values for this type of opportunity has all three. So I click save. So let me create a new Service Opportunity from scratch here.
And so I’m selecting a Record type of service, and I’m going to enter in just an example name and specify the required fields such as Close Date and the Stage. And remember, these stages are based on the different sales process that’s associated with this Record type. And this is a service record type opportunity which has the service sales process. And then as well, the Delivery and Installation status defaults to In Progress. And so the default designation for Picklist values by Record type that has to do with when you create a new record.
And so this is the example here. I did not click on that. It just defaults to that value, which I can set to a different value of which there’s only one other for this Record type. For this Picklist which is completed, I’m going to click Save and we’ll go back to set up and look at this a little further as well. If we were to visit the Details tab, we see that the Delivery Installation status, I changed that from the default over to the Completed status. And so if I go back to the Object Manager and set up and so then if I revisit, actually the Service Record type, we’ve got basically any Picklist values for this object. You can specify what the available values are in the Pick list by clicking Edit next to the different Pick lists. And so, for example, the Opportunity type here can be different types of existing customers or a new customer. And you can change these accordingly by clicking on them and moving them over and selecting them as well.
Defaults once again and clicking Save. And it works this way as far as Picklist values on any sort of Record type on any object. And so oftentimes when you create a new Picklist field, for example, if you’re creating that field on an object that has multiple Record types, you then have to specify the Picklist values in order for people to be able to actually select values. So, for example, on the Account Object, let’s create a new Picklist field. So let’s click on Fields and Relationships and then click on New to create a new Picklist field on the Account object. And so on the Account Object, we’re going to select the Picklist Radio button and then scroll down and select Next to create this new Picklist field, which we’ve done Picklist fields before, but I want to show you how this works when you have multiple Record types. And so I’m going to call this Roig, and that stands for red, Yellow, green.
And so I’ve been on projects where you want to designate the status of different accounts based on how the relationship is going. And red would be bad, yellow would be kind of middle of the road, and then green would be everything is going well. And so this is our Ryg Picklist field. And then we’re going to use the defaults for the rest of this. And then I’m going to click Next, and then I’m just going to accept the defaults here and click Next, and then add that to all the different page layouts and click Save. And so now we’ve got a new Picklist field. We also have a couple of record types on the Account object. And so let’s see if we go into an account if we can see values on that Picklist field. So if I click on the Accounts tab, let’s select ABC Corp.
Then if we go to the Details tab in order to get to that new field that we added to the page layout, remember, that new field is called Ryg, which is right here. And we double click on this. We’ve got red, yellow and green. And so we’ll go ahead and specify green status for this particular account and click Save. And so you may run into our encounter situations where you create a new field in Salesforce and then there’s no values available from the Picklist field. And if that’s the case, then you just need to go into Setup and make those Picklist values available for that particular record type. So I wanted to go ahead and demonstrate that as far as how to adjust those picklist values. And I switched over to salesforce. Classic. I’m not finding in Lighting Experience where to make those changes. So I’m flipping over to Classic. And if you click on the Force menu item here and click View Fields. And then if we find our custom field that we previously created called Ryg, you notice here that you can see the different Pick list values. Now what I mean by these not being available by Record type is if you select instead the Record types designation and setup under the Account option, you can see the different record types for an account. And so for example, if we click on Client, we’ve got our Client Record type and then one of the picklists available for editing is this Ryg field. And so if I click Edit, I could remove yellow, for instance, and click Save. And so for a Client record you could have then just red or green.
And then if I go back to the Account Record type selection and select Prospect, I could then edit this and let’s remove red and let’s make the default green and that’s on a Prospect. So if I click Save and then if I go in to create a new account, then let’s say I select Prospect and continue, then you notice that the default is green. And so oftentimes when you create a new field, some of these values may not be displaying or all of them may be missing. And so if you ever encounter a situation where you roll out a change and this may work for you as an administrator, where you can see all values but other people cannot, in a pick list, then the main thing to keep in mind is that you just need to go to the record type for the object in question and look at the different pick lists available for editing. And then once again, you can adjust those options by clicking Edit and selecting the values. And you can also set the default. Now that we’ve discussed creating Picklist fields and Record Type implications, it’s now time to get into Create.
- Creating Advanced Formula Fields
So now we’re going to talk about creating advanced formula fields. And so in order to create a formula field, you need to go into setup and it’s like creating any other type of field in Salesforce or Custom Field, for example. And you first have to go to the object in the Object Manager if you’re in Lighting experience, and then select the object that you want to create the custom field. For this first example, we’re going to be creating a custom formula field on the Account object. So I’m going to click on Account in Object Manager and then I want to direct your attention to a resource that I’ve made available in the Resources section of this lecture. And it is this file here called Examples of Advanced Formula Fields. This is a PDF that Salesforce makes available and it’s an invaluable resource to help walk you through creating advanced formula fields. And so I’m going to walk you through a couple of these and highlight a few that are very useful.
And then in the next lecture we’ll be dealing with creating a cross object formula field. But simply put, formula fields can do some amazing things and functionalities for you in Salesforce. And I’ve referenced this document often as a starting point because there’s a lot of good use cases and examples that you can draw from. And so you don’t necessarily have to know all the code involved in advanced formula fields. You can just leverage and copy this text here and put it into a field. And so for example, on this first page there’s these sample account management formulas and this one called Account Rating. We’re going to do a new custom field called Account Rating and we’re going to just use this text here. So I’m going to copy and paste this into my formula editor.
So I’m going to copy here and then basically this formula evaluates the annual revenue, the billing country and the type and assigns a value of hot, warm or cold to an account. It’s very much like the Ryg or red, yellow, green example that we did in the previous lecture. But this is based on the annual revenue and then a few other designations such as the type and the billing country. So I’m going to call this account rating. And so we’re going to go back into the Object Manager here for Account and go to Fields and Relationships and click New. And then for the Field type, since we’re dealing with advanced formulas, we’re going to select a formula data type for this new field. And a note here is that this is a read only field and it derives its value from a formula expression that you define. So we’ve dealt with formula fields briefly, but this is getting to more advanced functionality to show you based on this resource here that’s available once again from the Downloads or Resources section of this lecture. And so we’re calling this Account rating. I’m going to tab over for the API name of account underscore Rating, and then there will be an underscore underscore C appended to that once we’re all done. And so if we look back to what we’re referencing here, this is a formula that evaluates annual revenue, billing, country and type and assigns a value of hot, warm or cold.
And so that’s just a text value that is returned. And so we need to know that in order to figure out what type of formula we’re creating here. So we’re going to be returning just simply text as a result of this formula once it evaluates. So I’m going to click next to go to step three of five in this five step wizard. If you remember previously, I copied this data to my clipboard. So I’m just going to paste this and then let’s talk for a moment about how this works, basically. So I’m in the Formula Editor, and you may see instead when you first pull this up, the Simple Formula option. And so usually I deal with the Advanced Formula tab and it gives you the ability to do more as far as inserting fields and operators and functions. Let me delete this out for a moment, clear that out and then click on Simple Formula. So you notice for Simple Formula, you can select a field type and select a merged field. But for Advanced Formula, it gives you more options as far as inserting a field, inserting an operator, and these different functions as well. So you can build these formulas out by inserting fields manually.
And you can navigate to different things on different objects such as the Account. You could go to the Account Record Type, for instance, and select the Record type name and click Insert. And that’s a way that you can get to an API name for a specific field. And then as well, you can also insert Operators. And here’s the list of different operators such as Add, Subtract, et cetera. There’s the or with the double pipes or the double and less than or equal to, et cetera. And then as well, the different selected functions. You can insert selective functions and it gives you more details on what these functions mean. So for example, in a formula, you might use an and statement a lot. And this checks whether all arguments are true and returns true, if all arguments are true. So let me get rid of all this and paste in my formula again.
And you notice that this starts off with an if statement. And so if I find this in my list here, I can get more help on these different selected functions. And so the example, let me hit return here and insert the selected function. So this down here is what is inserted by default whenever you click if, and then click Insert Selected Function and it gives you the example. And then inside the parentheses after the if is logical test and then value if true and value if false is after the column. And so the description says it checks whether condition is true and returns one value if true and another value if false. And so we’ve got multiple if statements here. This first if statement has, then it’s followed by an and statement. So in order to understand this, let’s look at the and statement. And so an and statement, it checks who are more logical statements and so it checks whether all arguments are true and returns true if all arguments are true. And so it’s checking to see basically if the annual revenue is greater than $1 million.
And then also if it contains a billing country of some derivative of either United States, US, America and then USA. Let’s look at the contains function as well. And so for contains it compares text, it checks if text contains specified characters and returns true if it does. Otherwise it returns a false value. And then as well we’ve got this case function as well. And so a case deals with an expression and checks an expression against a series of values. If the expression compares equal to any value, the corresponding result is returned. If it is not equal to any of the values, the else result is returned. So, as you can see, there’s a lot of different selected functions here. And it is very helpful to be able to click on these and see what a sample is and get the explanation and then also leverage this resource for sample formulas, because a lot of times what you’re looking to do is available in this document and then you can repurpose it to fit your own needs. So for example, in this particular example we’ve got these values of hot, warm and cold. And so we could instead replace that with a red, yellow and green. And so if we wanted hot to be green, that’s a positive thing as far as if it’s a good account. And then warm would be yellow, for example, then cold would be red. As far as an account rating goes, we could adjust this accordingly to fit our own need. And so then as well, another thing I want to highlight is this check syntax button here at the bottom.
Especially when dealing with advanced formulas and especially if you don’t have a resource to draw from, you’ll often be building out your formula by hand using the Insert field, the Insert operator and Insert Selected function buttons. And then you want to check the syntax to see if everything evaluates correctly. Oftentimes you will get syntax errors that say that there’s a problem and you’ll have to troubleshoot and try and try again until you get the formula correct. And so it’s kind of like ironing a shirt, you’ve got to go over things you think you’re done and then hopefully you find a new wrinkle. This is the same sort of concept here that it takes multiple tries often when dealing with advanced formulas. And so since I leveraged this formula here, that everything evaluated correctly, there’s no syntax errors. It also gives you a compile size.
And so there are limits around compile sizes of formulas. And especially if you’re trying to compile multiple formulas together, you’ll start hitting this as well. You may end up hitting some compile size limits if you get into some really advanced formulas. And that’s one area where you would have to then resort to code. So one final note though, regarding advanced formulas before we move on is that this plus validation rules are the closest you’ll come to doing actual code on the Platform App Builder certification. As far as getting to this level on the platform. This is code like behavior. You’re dealing with some API names and some picklist values, and there’s some if statements, et cetera. And so you will need to do some code like behavior if you want to be a Platform App Builder.
And there’s not necessarily advanced formulas on the exam, but the concept of advanced formulas and what you can do with them will be represented on the exam. And so it’ll be a great exercise for you to go through fully this document. And we’ll be going into more of this in the next lecture before you go through all of this and see the different types of formulas fields that you can do so that you realize just what can be done via Formula Field. So you’re not resorting to code when you don’t have to. And so then finally you can enter a description and a help text for end users. You can, with a formula field, determine how to handle blank fields. If your formula references any number, currency or percent, fields, specify what happens to the formula output when their values are blank. So you either treat blank fields as zeros or treat blank fields as blank.
We don’t want to put a zero in this field here. We want either red, yellow or green or just leave it blank. So I’m going to say treat blank fields as blanks and click Next. And then we’re going to then make this visible to the defaults and it’s read only because we’re dealing with a formula field. So you notice you can’t edit this, you can make this available to other profiles. I’m just going to make sure it’s available to System administrator and my custom marketing profile because those are the ones that we’ve been dealing with for the most part. And click next. And then finally we’re going to add this to all page layouts as the default and click Save. And so now we have a new account formula field that we just created. And if you recall, it is called Account Rating. And so if we go back to our interface here and go to Accounts, clicking the down arrow, I’m going to revisit the ABC corp. Account. So now we go to the Details tab. Let’s see if we can find our new field or if we need to add it to the page layout. And so I’m going to do a search for Account Rating and it’s not found. Let me try and refresh this and just to make sure, because sometimes Lighting Experience doesn’t refresh unless you refresh the browser. And let’s see if that field is there. It should be in the page layout because we specified to add it to the page layout. So I’m going to click the Details tab again now that I’ve refreshed.
And we have our previous Ryg field, I noticed, which says Green, but now we see the Account Rating field which says Red. And so we’ve got our information here. This was the help text that I entered. So once again, there’s other types of advanced formulas that you can create, such as Account Region, and you can tell that these get really involved. And I’ve had an occasion to do things like this or do some advanced renaming of records and enforcing like naming conventions based on criteria like this, for example. So that if, for example, an account contains any one of these states, then for the billing state, then you could designate west or Central or east, for example. And so if you wanted to, you could enforce a naming convention so that once someone enters a record, it could override those values with the results of this formula field and all this can get really advanced. But another type of really helpful formula is a hyperlink formula Field, and this would be a Web field. I’m going to copy this.
This will give us the BBC News Search, and this is a hyperlink. And so if I go back to set up and go back to the Object Manager, and so we’re going to revisit the Account object and do a URL formula field next. So we go to Fields and Relationships and click New to do a new Formula field. And then once again, this one is called the BBC Search. So we’re going to create a formula field here. I’m going to click the Formula Radio button and click Next. And then we’re going to give this a field label of BBC Search. We want the Formula return type to be text and then click Next. And then I’m going to paste in my formula and check the syntax. There’s no errors. And then as well, I’m going to treat blank fields as blanks. And so you notice here that this text value is a hyperlink, and it gives you the string for the start of the URL and then it adds a name. That’s the name field.
So if we were to click Insert Field and select the Account name and click Insert, you notice it just gives you that same field. I’m going to undo that though, because we don’t want any spaces here. Let’s check the syntax again to make sure I’ve not broken anything I have not. And so I’m going to click Next and I’m going to add this to my page layouts as well. So now we’ve added a hyperlink field to our account page layouts. And so if I go back to ABC Corp. Go to the Details tab, let me see if I can find BBC. It’s not found. And so we’re going to refresh in order for this to display enlightening experience. And so now if we scroll down on the Details tab of this account, we should see URL field for BBC Search. And so you notice here we’ve got our new field called BBC Search. The text that appears for this hyperlink is BBC News. And if we click on that, it’ll do a search for the account that we’re on on the BBC News website. And so here we are on the BBC News website performing a search for ABC Corp.
Now we could do the same sort of thing for Bloomberg News, CNN Market Watch, and these different formulas form the ability to put together the URL plus the query for the account name, for example. So if we wanted to add a link for Google Search for an account, you could go into Setup. Once again, you go into the Object Manager and go to Account. So we’ll go to Account and we’ll click Fields and Relationships and then click New. We want to create a field with the data type of formula and click Next. Let’s call this Google search. And so the formula return type is where we want to return a type of text. Click Next. Then we’re going to paste in from that PDF the value there. And this right here is the text that appears in the link itself. I’m going to update this to say Google Search link in between the quotes, check the syntax and then I’m going to treat blankfields as blanks and click Next, and then Next again, and then finally add this to my page layout. Then I’m going to revisit the ABC Corp account. I’m going to go to the Details tab and doesn’t look like it’s there.
So I’m going to click Refresh and then revisit the Details tab. Scroll down. And now we have our Google Search link because I adjusted the text in between the quotes from what was in the example formula in this document here. And so if we return back to our link and click on that, that will open up a new browser window with Google Search for ABC Corp. And give the results. And so you can scroll through this document here and see sample case management formulas such as an auto dialer. This is another type of hyperlink formula that will make a clickable link for your soft phone system so it’ll pull in dynamically the phone number for the account or contact record that you’re on, or Lead Record, for example. You can do case categorization and then as well, suggested agent prompts for case management, suggested offers, and there’s also sample commission calculations for your sales reps. And then it gets into things such as greater than or equal to operators as well. So really any sort of functionality and advanced formulas that you need to get into. I highly encourage you to work through this document so that you start to wrap your mind around all the intricacies of what you can do with formula fields.
And so suffice it to say that you can do a lot with this and this saves you a lot of time of having to resort to code. This is kind of quasi code. There is some coding involved. But you’ve got your formula editor that you can use, your advanced formula editor and you can insert the operators and functions. And as well, there’s helpful tips around using date and date time values and formulas, had to do a lot around that. And you can evaluate and do things such as half days, for example, and then functions around today and now. And these have to do with date and date time values and dealing with the date function. And you can pull out years, months and days for specific date and one that I like and I’ve had to use before, if I can find it here, this is it here.
So I had an example of having to convert a date and display in the name field for a custom record. If something had a date value of one, it needs to be January, or if there’s a month value of two, display the string of February, et cetera. That had to do with enforcing a naming convention. And so if the value is a seven, then in the name string it would have July. And then a combination of like the account name and the contact name that I was dealing with on a custom object record. So as you can see, these get very advanced. And so in the next lecture we’re going to be actually doing, if I scroll back to the top here, we’re going to be addressing across object formula, which is this formula here specifically. So stay tuned for the next lecture as we do.