This conference will now be recorded. Hi everyone, we'll discuss what is custom sitting in Salesforce and how we can use it. Till now we know before when I want to store data, I'm going to create a custom object. So, what you do is go to Object create a custom object are all the fields and to assess the we use to write this construct. So, these are nothing but my transaction data. But these I have some set of data, which are my master configuration data, okay?
Which is not going to change anytime in the system. Or it's not going to change anytime in between my transition was planned in person. So, that kind of data we treat as much data for example, if you want to maintain all country code, country name and code in one place in system. So, you can create a custom object you can our country name and code and some relevant fields. And then what you do when you want to assess you will right. So, if you go with a custom object approach, but this country code unnamed, is it going to change any anytime in between the transaction not atomic.
So these are nothing but like one of my master data in my system, Master controllers in my system. So, so they need to store in my custom object fire, so fail to get it? Or is there any other approach to handle this? So what you can do on this kind of scenario, whenever you have any master data to store which is not need, we're not going to change during the transaction, we can store in a custom city. Okay, so we can store in a custom setting and to access the data from custom setting, we no need to play, no need to hire any SQL statement. What we can do, we can play a googled inbuilt methods, objects methods to get the data from the custom city.
So we will see what is happening and how we are going to create something, what type of questions we think we have, and how we can access the data from the person shooting. Okay, so let's see if you go to the setup. Let me go to setup. Let me show you. Give me two minute. Okay, just some searching your custom setting.
Let's close all this. Okay, so if you go here and open the custom setting, under the develop, what we can do, we can define something called affinity. So use custom setting to create and manage custom data in the organization level in the profile level or user level, or custom setting nothing but it's like it application memory or application cache. Okay. That means you can access it efficiently without the cost of inequalities are in a circles. And this data can be used by the few who keep some data from the thing you can use in Formula fields you can use in Visualforce pages you can use in any web service close any epics misses everywhere.
So now, when you create a custom setting, we have basically two types of custom settings. There are basically two types of questions reading which recall, list and hierarchy custom setting two types. One is nothing but list setting. One is nothing but my hierarchy concentrating. We'll see what is the difference between these two and what we can do see some time let me show you that part. The moment I click a new part going to come here, see you we only getting the hydronic heating.
So right now this list is converted to Mater at a time. Okay? So like if you walked before or if you heard it, so we used to have only discriminating which we like in any new or you cannot create it, but if you have an old or if you have an English consenting and you can create it so you can use it Okay, you can manipulate methods I will steal I'll show you what kind of methods we will use in the list. And now we will focus on the hierarchical society and how we can create hierarchical generating and in the Quad context and in the hydric for example, let's see, you have one product and pricing Okay. All you want you likes he can consider your organism works in different region. So, maybe in Asia in any country, let 6000 to a new ways in Japan, in China, Indian country, you know the organism is there and based on the country you want To set your some user information data okay for example, let's consider one more real time example if you want some configuration in the system where if any user who Paul as sales user okay they will see the discount price applicable to a product will be 10% but if any usual who follows sales head profile for example, so, for them they will see the discount price applicable as 20% okay and any other users or them discount price will be high percent.
So, how How we can configure this converter. So that means CPC, I am going to configure the data based on something called letting go back by definition what we have seen here that I'm show you something called profile level, usual level and Dennison level. instead of storing this data in any custom object, I can store in a custom setting and I can manage let's see, consider I'm just going to create a new custom setting. See before we are they say list of getting we don't have before we have a hierarchical study if you have any role or then you can see some list or something you may have. Okay, so in the hierarchy converting product can do we can store data based on the profile level usually labeled on admission level. And if you can see if you want to release concerting so self hosting, we can create a metadata type.
In the next tutorial we will see what is metadata type, how we can create it, everything okay, let's see. I'm just going to create a new hierarchical custom setting which is said discount setting for agent okay? Just a gap. This is nothing but like a custom object, but we no need to write any SQL statement. To get an instance, you can give description if you want, then click Insert. Now we have one dysfunction.
Now let's see I just cleared one field, which I call. Look, I'm just predicting the kind of numbers. We're gonna see. I just say, discount. Discount part of the page we have here. I'm just going to take the value, which you can display, but I can say this one percentage, discount percentage, something like that.
Let's see. I just give three. I can give you 10.25 Also, like the discount, like how clear the field demo you can set the parameter record unique original ID some default value, you can say I'm not doing anything, I just saved it. So now the data what I'm going to create on this person fitting, I can click on the Manage I can add the data. So I said the hierarchy custom setting what organization level or to your profile or user level, but then what are the owner level, if I want to say to the organization level the data, let's click on the new discussion you are now set the percent is as high percent in whole organism level, the percentage and giving us five. Okay, so now, let's I will set some Hello for my for high level or low level.
See, let's see I want if anybody from system admin user, they will have 20 to 20% discount. Like this same way, let's see I want to add one more Hello, user level. Let's go to a user. Let's see any of users who have known data that this user can have something called six. Any additional system admin, so I just don't want to say it. Okay, let's, I will change this profile to something else.
This is from admin. One second here so that you can see what are the things we have Okay, I'm going to put the profile having custom cells profile, they will have 20% for instance, okay. Now see, I set up my data in the system in a custom setting, where they can say the always what value you want was is the usual based what value you want to assess and profile based for now how I can assess this data In my code, let's see I will write a class and I will see without writing a SQL statement, how we are going to associate data c financing I will assess the data that means, I will access the data, what is value in my profile level? What is value in my usual level? Or what is the hell do we have said in the initial level, that kind of assets we have to do.
So, now let's see, let me close all these fingers. Okay, so now I'm just going to my anonymous window just to see what we can do here. So now, let's see, this is my custom fitting. Let me go to custom setting once again. Okay, this is my custom fitting. So you can see my custom fitting APA name also ending with underscore underscore, see, okay, now, I want to get the Custom Settings configuration for my other in some organization level or we can do that See, I just gave the name of discount cost routing, the instance name.
And now to assess the data, what configured in the organism level, what it can do, we can use inbuilt method, which you can get or default gate or the difference. If I use this get on default, let me put it in the debug statement to show you what value I'm going to get here. Okay, let's see. Our default value is let's treat it in different ways. Okay. So let's see what the log coming now that we have on the log also aggregate knowledge see the log file for evaluating.
So if you see I got completely okay. There are many inbuilt fields. So Tony, did everything we got and we'll see what is available. See you soon. Personal injury. So here, I am able to get injured Hello What I have here the same way, if I want to get for a specific profile, okay, or a specific user, or they can be here.
See, I'm just going here, again the same method. But instead of get off the poll, we can use get instance. So I'm just targeting to a particular instance what I want. Let's consider on this case, I'll just try to get the Hello. That will try to get the value for this. I'll just directly give the ID you can write a SQL statement or any other ways to get the profile ID or user ID, but I'm just giving indirect profile ID value and we'll see what is happening.
Okay, so now let's see, I just give a DSP. So what value Am I going to get it? That's an integrated so if you see the log file there it open. There are some disappointing only debug statements. See the past line giving the pipe the signal and giving it only. So when the perfect level we showed as 20 and or the OG the polo shirt has five?
The same way if I want to assess the value for usually will, I have to use the same as a good instance. But I have to pass for which instance I want I want for a particular user. If you see I have one user, let me go here. Okay, so I have a user here. And I have to set the value for this user. I have just taken the ID in other you can use user info current user ID, anything you can use to get the ID.
For this instance, this example I'm just passing this example. Okay, so a DSP is near my understanding here. Now let's integrate. Now if you see the log file again, we'll get all the values. So now, what are the configuration we have dude for profile level, org level and user level, everything we get? Let's consider, I want to get disconcerting for a user Who is not configured?
For an example, if you see from the list, I'm just going to take this security user. Let's see you participant in here. He passed his user ID, the DSU for the understanding of the script ID. Now let's see what is the log file. If we go here, give the debug only then you see the value can Piper engine is nothing but the organization default value what we have we got that value. So if any user not configured in this custom setting, then they are going to get the default value.
And semi the least cultivating what we had before. That's the magnetometer type. Okay, we will see how to create a custom metadata, and how we can get the data from there and a lot more things we can do in the metadata in the next tutorial. Thank you.