What is custom setting and its methods

Salesforce Development Using Apex Custom setting in salesforce
14 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€48.10
List Price:  €67.35
You save:  €19.24
£39.88
List Price:  £55.83
You save:  £15.95
CA$71.97
List Price:  CA$100.76
You save:  CA$28.79
A$80.16
List Price:  A$112.23
You save:  A$32.07
S$67.96
List Price:  S$95.14
You save:  S$27.18
HK$388.27
List Price:  HK$543.62
You save:  HK$155.34
CHF 45.02
List Price:  CHF 63.04
You save:  CHF 18.01
NOK kr569.59
List Price:  NOK kr797.48
You save:  NOK kr227.88
DKK kr358.90
List Price:  DKK kr502.49
You save:  DKK kr143.58
NZ$88.63
List Price:  NZ$124.10
You save:  NZ$35.46
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.45
৳5,972.19
List Price:  ৳8,361.55
You save:  ৳2,389.35
₹4,258.89
List Price:  ₹5,962.79
You save:  ₹1,703.89
RM224.30
List Price:  RM314.04
You save:  RM89.74
₦77,378.02
List Price:  ₦108,335.42
You save:  ₦30,957.40
₨13,924.71
List Price:  ₨19,495.71
You save:  ₨5,570.99
฿1,707.62
List Price:  ฿2,390.81
You save:  ฿683.18
₺1,762.36
List Price:  ₺2,467.44
You save:  ₺705.08
B$310.08
List Price:  B$434.14
You save:  B$124.06
R926.14
List Price:  R1,296.68
You save:  R370.53
Лв94.05
List Price:  Лв131.68
You save:  Лв37.62
₩72,995.06
List Price:  ₩102,198.93
You save:  ₩29,203.86
₪183.24
List Price:  ₪256.56
You save:  ₪73.31
₱2,921.84
List Price:  ₱4,090.81
You save:  ₱1,168.96
¥7,853.11
List Price:  ¥10,994.99
You save:  ¥3,141.87
MX$1,006.35
List Price:  MX$1,408.98
You save:  MX$402.62
QR182.19
List Price:  QR255.09
You save:  QR72.89
P691.26
List Price:  P967.82
You save:  P276.56
KSh6,461.20
List Price:  KSh9,046.20
You save:  KSh2,585
E£2,544.49
List Price:  E£3,562.49
You save:  E£1,018
ብር6,361.91
List Price:  ብር8,907.19
You save:  ብር2,545.27
Kz45,590.88
List Price:  Kz63,830.88
You save:  Kz18,240
CLP$49,514.09
List Price:  CLP$69,323.69
You save:  CLP$19,809.60
CN¥364.84
List Price:  CN¥510.80
You save:  CN¥145.96
RD$3,032.23
List Price:  RD$4,245.36
You save:  RD$1,213.13
DA6,760.37
List Price:  DA9,465.07
You save:  DA2,704.69
FJ$115.98
List Price:  FJ$162.39
You save:  FJ$46.40
Q385.05
List Price:  Q539.11
You save:  Q154.05
GY$10,455.66
List Price:  GY$14,638.77
You save:  GY$4,183.10
ISK kr6,980.10
List Price:  ISK kr9,772.70
You save:  ISK kr2,792.60
DH502.81
List Price:  DH703.98
You save:  DH201.16
L922.32
List Price:  L1,291.33
You save:  L369
ден2,959.81
List Price:  ден4,143.97
You save:  ден1,184.16
MOP$399.96
List Price:  MOP$559.97
You save:  MOP$160.01
N$920.98
List Price:  N$1,289.45
You save:  N$368.46
C$1,839.04
List Price:  C$2,574.80
You save:  C$735.76
रु6,810.12
List Price:  रु9,534.71
You save:  रु2,724.59
S/186.41
List Price:  S/260.99
You save:  S/74.57
K202.74
List Price:  K283.85
You save:  K81.11
SAR187.78
List Price:  SAR262.91
You save:  SAR75.12
ZK1,383.10
List Price:  ZK1,936.45
You save:  ZK553.35
L239.36
List Price:  L335.12
You save:  L95.76
Kč1,209.95
List Price:  Kč1,694.03
You save:  Kč484.08
Ft19,835.61
List Price:  Ft27,771.44
You save:  Ft7,935.83
SEK kr553.09
List Price:  SEK kr774.38
You save:  SEK kr221.28
ARS$51,277.48
List Price:  ARS$71,792.58
You save:  ARS$20,515.09
Bs346.08
List Price:  Bs484.55
You save:  Bs138.46
COP$219,391.32
List Price:  COP$307,165.41
You save:  COP$87,774.08
₡25,377.51
List Price:  ₡35,530.54
You save:  ₡10,153.03
L1,269.45
List Price:  L1,777.33
You save:  L507.88
₲390,156.27
List Price:  ₲546,250
You save:  ₲156,093.73
$U2,225.52
List Price:  $U3,115.91
You save:  $U890.38
zł205.57
List Price:  zł287.82
You save:  zł82.24
Already have an account? Log In

Transcript

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.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.