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
€46.41
List Price:  €64.99
You save:  €18.57
£39.85
List Price:  £55.80
You save:  £15.94
CA$68.38
List Price:  CA$95.74
You save:  CA$27.36
A$75.69
List Price:  A$105.97
You save:  A$30.28
S$67.65
List Price:  S$94.71
You save:  S$27.06
HK$390.96
List Price:  HK$547.38
You save:  HK$156.41
CHF 45.35
List Price:  CHF 63.50
You save:  CHF 18.14
NOK kr542.95
List Price:  NOK kr760.18
You save:  NOK kr217.22
DKK kr346.22
List Price:  DKK kr484.74
You save:  DKK kr138.51
NZ$83.20
List Price:  NZ$116.49
You save:  NZ$33.28
د.إ183.60
List Price:  د.إ257.06
You save:  د.إ73.45
৳5,484.79
List Price:  ৳7,679.15
You save:  ৳2,194.35
₹4,174.22
List Price:  ₹5,844.24
You save:  ₹1,670.02
RM236.85
List Price:  RM331.61
You save:  RM94.76
₦61,737.65
List Price:  ₦86,437.65
You save:  ₦24,700
₨13,903.63
List Price:  ₨19,466.20
You save:  ₨5,562.56
฿1,842.69
List Price:  ฿2,579.91
You save:  ฿737.22
₺1,612.90
List Price:  ₺2,258.19
You save:  ₺645.29
B$253.75
List Price:  B$355.28
You save:  B$101.52
R922.13
List Price:  R1,291.06
You save:  R368.92
Лв90.85
List Price:  Лв127.20
You save:  Лв36.34
₩67,969.88
List Price:  ₩95,163.27
You save:  ₩27,193.39
₪185.94
List Price:  ₪260.34
You save:  ₪74.39
₱2,861.35
List Price:  ₱4,006.12
You save:  ₱1,144.77
¥7,722.34
List Price:  ¥10,811.89
You save:  ¥3,089.55
MX$843.21
List Price:  MX$1,180.56
You save:  MX$337.35
QR182.28
List Price:  QR255.22
You save:  QR72.93
P678.57
List Price:  P950.05
You save:  P271.48
KSh6,648.67
List Price:  KSh9,308.67
You save:  KSh2,660
E£2,385.52
List Price:  E£3,339.92
You save:  E£954.40
ብር2,869.28
List Price:  ብር4,017.22
You save:  ብር1,147.94
Kz41,825.96
List Price:  Kz58,559.69
You save:  Kz16,733.73
CLP$46,485.20
List Price:  CLP$65,083
You save:  CLP$18,597.80
CN¥354.33
List Price:  CN¥496.09
You save:  CN¥141.76
RD$2,899.21
List Price:  RD$4,059.13
You save:  RD$1,159.91
DA6,716.85
List Price:  DA9,404.13
You save:  DA2,687.28
FJ$112.23
List Price:  FJ$157.14
You save:  FJ$44.90
Q388.45
List Price:  Q543.86
You save:  Q155.41
GY$10,455.72
List Price:  GY$14,638.84
You save:  GY$4,183.12
ISK kr6,977.10
List Price:  ISK kr9,768.50
You save:  ISK kr2,791.40
DH500.96
List Price:  DH701.39
You save:  DH200.42
L885.56
List Price:  L1,239.86
You save:  L354.29
ден2,861.59
List Price:  ден4,006.46
You save:  ден1,144.86
MOP$402.29
List Price:  MOP$563.24
You save:  MOP$160.94
N$920.44
List Price:  N$1,288.69
You save:  N$368.25
C$1,839.55
List Price:  C$2,575.52
You save:  C$735.96
रु6,679.37
List Price:  रु9,351.66
You save:  रु2,672.28
S/186.27
List Price:  S/260.79
You save:  S/74.52
K193.32
List Price:  K270.67
You save:  K77.34
SAR187.48
List Price:  SAR262.50
You save:  SAR75.01
ZK1,358.11
List Price:  ZK1,901.47
You save:  ZK543.35
L231.01
List Price:  L323.43
You save:  L92.42
Kč1,161.35
List Price:  Kč1,625.98
You save:  Kč464.63
Ft18,056.25
List Price:  Ft25,280.20
You save:  Ft7,223.94
SEK kr542.25
List Price:  SEK kr759.20
You save:  SEK kr216.94
ARS$44,003.90
List Price:  ARS$61,608.98
You save:  ARS$17,605.08
Bs345.36
List Price:  Bs483.53
You save:  Bs138.17
COP$195,270.45
List Price:  COP$273,394.26
You save:  COP$78,123.80
₡25,568.20
List Price:  ₡35,797.53
You save:  ₡10,229.32
L1,234.61
List Price:  L1,728.55
You save:  L493.94
₲373,712.67
List Price:  ₲523,227.64
You save:  ₲149,514.97
$U1,909.55
List Price:  $U2,673.53
You save:  $U763.97
zł200.30
List Price:  zł280.44
You save:  zł80.13
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.