SOQL,UPDATE,UPSERT,DELETE,MERGE in Apex

Salesforce Development Using Apex Apex and its Database language
53 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 and typically start to next week. So, let me know if you have any question anything like from the previous one if you have any confusion anything not from me you are also fine bank is not audible. Okay, then we'll start for the new topic, we will see what again. So, they know it is closed about the database operations like insert and that I was going to insert. So insert what into insert, it can insert exactly one record or maybe collection of records. Okay, so in that way we discuss insert treatment.

And that same operation we can do using database dot insert also Okay. So, this module we have discussed in the bigger system. So, now, when I said in database and I discussed it can do multiple activities nothing but like create, update, read and delete. So for create nothing what we discussed that insert, so, if I have some record in my database or in my object, then if I want to manipulate let's say there is a record of candidate whose mobile number is wrong, and now I want to update it and how can I do it? So whenever I'm trying to update something, that means it is an existing record customer form. So if that existing record, then I can modify it, okay.

So past usually record and then elaborated. Again, these are better we can do in two ways. One, we call us database dot update, the class how we use database or insert. Similarly, we have objects segment also. And I'll see syntactical How we can do these things. Okay?

So if my record is already existing database, that means before update, I have to get it. So I will Okay, go and update in assist mobile number. That means I have to find assist number assist record, then I have to build it. So now I'm going to update so past what I need, I need to get that record. Okay. So I need to get the record just wandered.

So when I'm saying to update the record, that means I'm trying to get it then I'm modifying the value. So how we can get the record from the system. Okay, what are the records I have, how I can read it, how I can pitch it So, to get the record what we do here, we have some query language I can write some query language or query statements that are meant to return me some record. So, what is that a thing but I can say something called SQL. So we should call Salesforce objects object query language, okay, same way when somebody say go and delete a record or anything to go on till the recall, that means files, find the record, then delete it. So, to find that record, I need to know about a circle, okay.

So party this is okay. And how I can use in sensors, okay. Then, we can see after that in the record, how I can update how I can delete or how I can do on any other activities. Okay. So when everything is so cool, participate. So for example, let's see if this is my database table now.

It will grow table now here okay. So for example, this is one table for me okay. So on this table I have many records okay and each table object has many columns or fields. So which field I want to get from which object I want to get everything I can specify here okay. So, if a normal syntax of writing is SQL what is the syntax of writing a sequel. So, all in SQL statement starts with select select keyword, then whatever the field I want to address, you may access one field or many fields okay one or many field separator by comma okay you selecting the fields from each object, so then object name Okay.

So now me place it gets me record from the subject. So that means I May or June I'm trying to get all the records from the subject sometimes I may say okay get me the records from the subject where candidate name is arses So, that means, I'm just trying to put a condition. So, give me the record or test the record whereas name matches. So nothing but what I am doing here, so, I am putting one condition on my statement okay based on this condition if any record match then determine that one. So, for that what I can do all the conditions we can write a statement where nothing would make on the same statement the basic statement district a circle second, on top of that, we have many clauses which you cannot okay and these conditions may can be and or anything okay. Then the region what we are getting, if I want that result to display in a specific order, so we can do USE THE ORDER BY clause.

Okay, so we'll go one by one. So we'll see if has a simple statement. For example, if I say I have a candidate object in the candidate object, I have a candidate name as assets, then how will get the information or record from that object with a matching condition what I do here, either Excellent. So let's see. I just want to touch ID name. Let's candidate.

Resume. Okay, email call from candidate so pardon my condition here. I want my name should matters. Let's see I committed this name nothing. Personal. Okay, we're past pass name equal to Okay I think that means it will try to talk to candidate object get this column information or these field informations where the past stimulus is it will try to get only the record where the past name matches with this part.

Okay? As is if I get anything then I'll get that records. So, I may have candidate assess exactly one on my system, but I may have assist Malhotra assist does assist Mr or anything. So, right now if you see on my system I can have exactly one SS or I can have many SS. So if in my system nav one SS then this statement returns me exactly one record. If I have many, many assets like SS Manoj Ross's Mr. Roth is Monday.

So I can get many records so that means this so kill can return me one or more records depending on the condition what image if it is returning more records that means if you see this statement this candidate, so quill returns me, many candidate records nothing but he said we can make collections. So what is triple can return, it can return exactly one a subject record, in this case, nothing but can be a record or it can return me a list of collections. Okay? A list of a solid record, in this case is nothing but a list of candidate record. Okay, so, remember passing the circle can return exactly one record or mini record, someday they may say, give me total number of candidates and just on my candidate object, okay, so in my database in my kanji database, I may have 50 candidates, so it may return me a given number, the count of all time periods.

So I can say a circle can return exactly one integer, the sum or average of anything, okay. So, in overall what we can say is okay nothing but Salesforce object query language, which can fetch record from the objects a subject, and it can pitch one single record, or maybe a collection record, or maybe integer value, okay? to any confusion, no. Okay. So whenever right is SELECT statement, the basic select, and the field party want to fetch, okay, select the field, what do you want to pitch and from which object and if you want to put the condition and then look for your condition where this condition match. If this match, then we'll get them gather data.

And this condition, you can write with iron or anything. Okay, we'll see Each one may one or the conditions we can pull and what we can do. So this is completely basic statement. So now we will see our objects. So let's see, I'm going to account object Okay, in record object, we have many, many records for it. So, we will see the complete high level syntax of this appeal.

And then we'll see how we can manipulate in our account record. So if you see me in my account, I have many things. So I may put a condition based on any field or I may put conditional invest on some other order records or maybe in some other inputs, okay. So how we can write all all these things. Okay. So, now we will write complete syntax of discipline.

Okay. And we'll see what we can do here. No conversion delay. Okay, so now one thing else. So when you're encoding the USCIS record from database, so in my data database, I may have two clickers, but I want to get only top five. So past five records I want to get that means in my database, I even have the hundred records, but I want only top five of the past five records have been good.

Or like or maybe I want to get all the records. Okay, queer candidate last name or past name starts with a message. It may be ISIS, it may be or Sharia anything, okay? So if any candidate starts with a message, then how we can do it. Okay. Or how can I control the records with numbers like, instead of all the records I want to control, with disrespecting?

Okay, now may get many records, all the records I want to display in a sorted order how I can do it, okay. So all these things, how we are going to write in a sequel, okay? Anybody knows about limit offset an order by Sony with limit, we can just get the exact number of records what we want to like lexar limit 10 so we will get only 10 records from the database or something like that. Okay, so it's nothing but for top 10 Records we'll get it. Perfect. Now let's see, we'll write one completely is open then what questions are discussed we will see everything for everything.

So all the circle statements start with Select OK, then the list of fields What do you want? Okay, which comma separator then Put from each object name then if condition needed then we'll put the well condition like past medical assists or maybe account revenue is greater than something okay. Then if you if you want to grow by a particular field, we use group by let's see. Now the I I like this statement I will show you Okay. Then if I want to order by the fields I can add order by okay. If you want to limit the record to display you can limit you can give any integer value less than or maybe 10 how many records to display you want offset I left in what what is the limit and offset there is a difference.

You can give some integer value offset. Okay. So now what is 42 here, let earring this I'm going to write something has to go this is statements. So now I'm just opening my double Have a console where I can wait a few seconds. And I'm familiar with contacts. Now see, you can see creator.

Here I'm writing the circles to show you. Also, I lied in our anniversary window to sales to show you how we can keep this in a collection. So now on which of the day you want to write, I can click on this pile I can go to open, okay, I can see it object, okay, I'm just going to object. Let's insert an employee. So the contact they associate, I got contact. Okay, if you see all the contact fields are there, we really want to just fill in that you can write it or you can normally select it also, as well.

I just like to have this. Okay, let's see mailing postal code. Sorry. Now I don't have any conditions. The slip will come from Kentucky by road. Then what happened?

You You will try to pace all the content from database. See, everything is correct. Now I want Give me the contact, which having the postal code simply go on, put the condition for your mailing for cellphone number district, the mailing postal code not equal to null. If I do this one see now my query filtered, Complete database and I got dispatch. Okay, now see, I got this across but I want to show the records in a certain order. So what I do here, I did order by let's see, order by passman.

Nazi pathname jack bed and do something I just didn't do it. See now etc. So now this order by again can be ascending or descending. See, if I do d c. If the same is hidden by jack Andy so by default mice order by comes with his nipple you right or don't right it will be the sort of attending okay? So if you want order by so now see if I don't have this other way okay so I don't have this this pad also I pointed to this one it gave me complete list of contacts list of collection of contacts okay now on this I want to group by this field with a specific account see if you see these two calls in same account okay now let's consider I'm just doing group by account ID I'll show you what what is happening here now. So now when I'm doing this until most groups are exited it because I have the past feelings of it So I don't want to destroy the idea think anything I just want to go right okay.

So, let I will take these as account Nell trees always duplicate name our name were agreed upon let me go to here there's already tried to group by on the same object field so like I can see how many fields do we have in the same same room with him but same name let's see here like if anytime you have used to report on you to the group by the same concept we can use here also. If you leave this group I know I'll show in the normal objects programming. You tried to return me in the fall Sherman completely. Okay, so leave this for now I'll show report and I'll compare compared to here. If you see my content, I got 20 controls here to tell us 20 out of 20, I want to get only the top five. I just go here I did limit of five.

If a man here went into limiter five, I just got a deadly fiber with ancient nd nothing but if you see 12345 these five records so now I want to get the record, not a pipe Want to get records from this? teller? Okay? numbered 12345678 something's delivered based from studying from these records. Now, that ain't what I do, we can offset if you do limit pay, we get the top I record if you do opposite there was sorry to interrupt. So when you set top five, so how it identifies whether it's from the created date or from the base name alphabet, yeah.

No, it is not activate is created in that Okay, thank you. For all these efforts are there everything in one index? Okay. So who is he who is in the last index? That will pin them? Okay, so now when I say offset, let's consider 10.

If you see rows 1-234-567-8910 it comes to this much place. Now integrate, see, now I start from God says Do so nothing bad comes here. So, now if you go by index index the row starts from past record index one index two index 345678 910 So, when you do offset it will fetch the current from there only saved from Joseph status. So, now I see my record from there it will display all records not 10 Let me show nine then you will see out of 20 I skip nine records and the records from there all the main record will display here okay. So, that moment you can go for upset Okay. So now any confusion no okay.

So, whenever it is a circle segment Always remember that should not be more than 20,000 characters always Okay if you try to write a circle who is going to be compared to some time of comparison length of 27 characters more than you can write it, it will give give you like 22 complicated errors. Okay, so that is wincy noise Okay, so let's see, we'll go and we'll write same thing in our window. So now, I want to pitch record from my content, all contracts, poignancy, I want to write that. So, all contract nothing but it's a collection of records. So which I can say list of contacts so my user can return a single record or can return a collection of records. The list of contacts, which I say the name of contact list, I wrote a circle segment all circles segment will be inside this bracket, square bracket.

Then I'll or select so Now I just ID name. Let's see first name. Last name corndog name. I can I didn't make the switch but you can see properly. Let me maximize it from which object I want from contact object. Okay.

Oh yeah, no no hair condition I want to get everything. If you see I got all the liquid. So now I want to process each record and I want to change something. Okay, so in the last name, I want to tag underscore test, for example of how I will do it. So now I want whatever the contents I have on my system. I want to update their last name as underscore Okay.

So, that means get get all contracts by writing a sequel then go and manipulate how we will do it. So, my contract store in the collection so I am writing a for loop for each contract from the contract used. So, I wrote the called loop contract CO in from Florida listen. So, in this simulation, nothing about going when somebody says this follow up follow news remember how to write is follow. So, what is my collection? So, I'm just reading the syntax of this okay.

So, see how will it write for give to bracket close it so, on which collection you want to manipulate. So, I want to manipulate on contact list so, give the collection name after this bracket, then that collection contents what record that collection contains this contact record, okay? Nothing but my collection type. Okay, then condition nothing but a mere 10 record on record. So, for each record how you want to represent I want to represent like one reference name nothing but something. So, in this example if you see my contact list nothing but my collection, nothing but contact list and contact list is your contact type.

And this email reference name, so I can refer each contact with con. So now on this what I do here, so I went con.my last name. So what I want to do in call dot last name parties there, I want the money paid to convert last name equal to Okay, underscore test what is there with that tag underscore test? So how much thing came doesn't go and update on this contact list? Okay, so when I'm saying update, so again, we can write this UPDATE statement using two ways. One is direct objects.

Statement, which can update one singular subject record, or can update collection of collection of records like the same way we did for insert. You remember the insert statement we do like this insert account, we did a single record, same I do here. So update nothing but we can write, update a subject record, nothing about a single record, or it can contain update collection of a subject record. When I say subject, it can be any record, another record, or maybe customers. This way we can update it. So this is one approach.

Let's see. I went and I'm just going to execute it. Like dude, it will show happening in related content. So I have a mistake here. See you nta city executed if you go here, from database, I page all the records and all A contract to underscore some test. If you see a token the unspecific icon SSP contract.

Do you see my name tag with underscore underscore test with a plugin Did you see my last name is something underscore test. So this way we can operate same way how we can use my database operations here. Same mechanism. I don't want to do this one. I said all contracts. So now all the contracts have my underscore test.

I don't want to keep I just roll back ologists came here like this. So now the content what came I want to do? database dot okay see something I have called. I have co opted, pointed to update. It can contain a list of collections. Okay, wait.

You want to update everything or partially? Like how we did that episode? Same way we can do that amended orbits that are nested orbit and which returns again that is your save result array. Okay. So what is my collection? My collection name is contact list okay.

So do you want everything or no no I want partial audit okay. So it is going to return me what that is dot several items. Then as like in the previous one how we write, follow for these and percent same way you can do it also here and is going to integrate. Now we did it. So now, if you go and see, this is a grocery assembly pressing this will go back nothing changed. We'll see what happens.

Why not yet Okay, so cornered last name was before understood and respected. Now also entrepreneurs persist. And we want ideology. So before what happened in a query quarters my last name, my last name was something with underscore underscore test. Okay, and we want to change it. See, I didn't mean anything I just gave same Hello.

So how will change it now anybody can tell the logic. So now, everything insert underscore underscore test, I will tell how to write this. Okay. Now when I see this one, this last name, nothing but a string. So from the string, let's consider name it there versus underscore underscore test. Okay, from these, I just want to keep only the vs and remove underscore test for so after underscore parties there I want to remove it.

So now from this training, I want to get where this on disperse tears and remove everything. So now this is a string. So now we're going to manipulate strings, I'm just telling you how we'll do it. Nothing to remember in Salesforce, no method, whatever they are known individually No need to remember just go here, type string mappings, you will get all predefined methods given by String class, in our program, we'll get it, then we'll build the logic. So past I want to get what is my index of these from this index? I'll remove it, and I'll keep everything everything as it is if you see here, see, if we go past I will check if my string contains underscore or not.

If content See, Do I have anything content method element for content, okay, contains any if contents then we'll exclude it. So past I go and check here. This is just an extra logic am saying is not related to a circle but To make you can make a little bit convenience. Okay, how you do it see content signals call this underscore somewhere in the conduct last name if it contents on the score I want to remove everything okay, I'm just I don't have anything till now Anyone have this lined out this line number eight asuni Yeah, I'm good. Perfect. So if it is under content is then what I do.

I'll go remove the content underscore underscore test remove the text, underscore underscore test whatever thing I have how we'll do I don't know how to do let's see if Do I have any metal you know, see if it's such remove I don't have anything okay see somebody there remove in substance all operands of the specified suffering return the string result okay? or remove in ignorance images you can read each method Okay, I'm just going to use the simple method remove Okay, I don't know what is there or not I simply went and using what I want to do I want to remove okay if you see these contact I have something underscore test I want to remove this okay. So from where they remove I want to remove from conduct last name okay. So pointed to this remove what happens if you remove you can see the examples here.

So it returned me another string that is nothing but going to be my last class it's a simple program but simple logic I just said C to write this logic. I don't need to keep anything in my mind. I have reference I see there is perfect You know, I'm saying you and no need to know how to do everything by hand remember, again, but you should know what is there and how it should be living. Now I go on a given date something happened. Let's see, I just joined I just depresses see contest? Three or sheeny as is clear.

Yeah. Perfect. So same way we did this update, this update you can use as a statement or a database method. Okay. So you know how any database method we can use it as one. The cards to process or passively to process, okay, if you want all the record to persist, then allow all or nothing by controlling the second parameter true or false.

Remember that? Okay, then we get the same result if you want to manipulate the same result, the previous session, how would you you can do in that way. Okay, now if you remember we have created many accounts for it. Let's see, we kept it many, many accounts. See, I don't want that many accounts to keep on my system. I want to delete it.

So what I'll do you see this account it is a contra circle, I want to delete all the accounts whose name starts with this. If any account activity stuck on one or maybe a second 69 or maybe test account 100 forward maybe if any account starts with test, I won't read it. so fast I should get the account which starts with test how we'll get it same way with a with this account, I will get a list of account records. Okay, so I just give the name adjacency list. So I just going to write one is okay. See net let's ID I don't want any other field managers in the same place kept ID from account okay.

So, what is my logic I want to get our count where name starts with I want something like this Kurt starts three test correct. So now when everything starts to state, so in Sissoko, it will ship it will they can be written as like different software name like this. So, it starts means after test it can be any word test XYZ test 123 test account anything but the past four characters with this then you right this person does if you want Okay, no if any account LC test then you write this way. It can be any characters was last year drillbit test. If you are no it may be anything but in between anywhere, there should be there. It can start with anything it can end with anything, but in between or any heard this video then you can write this right but now my purposes get the account name is like this.

The same way what we can do here, we can do that I will start, delete or normally segment in the same way we have already one delete I won't delete all the account list I just simply writing here SSL list okay I want all of not all of these you can do all if you want normal at a delete shipment simply you can use this also any condition either of these anything you can use. So if I delete the eval equals this two line of code, then it will delete all the accounts whose name starts with test. Let me see I just go and click Execute highlighted. So, it will include this two lines of code which I have selected. Now if you see I paired Delete statement or my recorded Let me see what happens I have no so yeah I don't have any accounts with Tasker well the name starts with test got it any confusion delusion?

No no perfect or Sweeney see assess no okay. So if anybody gives you to write a DML statements you can write it maybe insert member update member delete okay so now whenever we say update and we say insert, there is some time when you don't know what it means nothing would let me in explanation. So now, I have one database where I have many records. I'm just writing dummy records here. Okay? So now dynamically or maybe Iran name or maybe ignition time, you don't know you need to insert one record or unit to obliterate a car.

It may be either you may come to insert it or it may happen may update some industry record. You don't know what operation you're going to perform Okay, nothing but I can say sometimes it may happen. You may update some existing record, okay. Or you may insert records but don't know what will happen in runtime for will happen in ignition time. If you get the record in the database, then you operate it. If you don't get it, then insert it.

So both operations, Salesforce combine in another statement, or just redmon. Let me show you so you can see this one. Okay. So I'm just breaking it. If you see this cover line, I think what offset So, both the statement covered as one statement, which we call offset, the offset is another DML statement, what happened here, it may update an existing record or it may insert a record. That means when you pass the collection of records to the system, then it will check if the record exists in the database and going over it if not exist, then go on into the for example, I say always for you Never manipulate data because you always try to hit the database as minimum as possible.

Okay, for example, I will have a scenario where in the same function, my transform starts from one place Let's I start my transition from one place. And I'm computing here in between this line of codes. Let's see, I wrote many lines of codes on these clients. Okay, so here, I want to update content and after some time, I want to insert a content. So now I'm going to piratebay students go and update then I do some court then go on Insert, insert of that, these two statements, I can convert to opposite Okay. So now, this absurd statement will take both the collection of elements go to database one time, insert the records which need to be inserted an object the records, which need to be object so absurd In a statement, which can insert or update records.

Based on the availability in database, okay, how will you do that? For offset cells was given one statement which we call offset, same way you can use offset statement or database dot offset. Okay, so how will do that? Let's see, I'm just going to this program again. Okay, so now I am going to get these contracts but I'll make on this not understood. Okay I'll just to go on get exactly one not all I want to get exactly one content Okay, I kept limit to one, exactly one contact contact I'll get I will change the name to on this protest.

Okay That means I'm just trying to update one account 31 contact and same time I'm just going to create a new contact, okay. And I'm just telling a very basic programming Okay, so when I'm saying new contact like last time we did insert, I'm just trying to insert one record. New, last name equal to. Okay? absurd example. Now, see what we used to do, we should do here, insert contract, and we should do here.

Update contact list. Okay, if I do this one, let me so I'm not doing anything else. I'm just doing this one. If you see if I'm going to execute the chart, what happened here? Let's go on issued. So I want to update the content which I have coded, and I want to create a new content.

And the moment I want to execute it, I do it. I'll show the log file what happened. Now, I have hired two DML statements, one to update and one to insert. Now if you see here, go and see here. Number of DML statements See here, number of times I queried my database using SQL query one time. query returns me one record.

So cell identifier DML statement I had two times, okay? And it content two rows, two times a pair. But see, but same object I'm going to hit many times here. But if I can combine these two statements in one place, nothing but I can do something like this absurd. Okay, let's see, contact list, but my contact list issues one. So on this contact list what I got, again, this new contact also keeping in that memory variable, using the AR RT digital list.

Now if I go on agrico distract me. Okay, let's see, I go into this. What happened now? Let's see absurd example. To hear as a theme name. Yes.

We will Already I have included one. So again, I'm doing so I did this. I do execute highlighted go here and now I'll show you the past time I'm going to hit that I was how many days past Do we need to see that? If you go here let me scroll down. I'm just going to hire DML statement one time which content to do. So I just fired one time I just hit that one time to do my DML update and insert the two different DML I'm firing one time using absurd statement.

Okay. So we need to observe what happened. It may insert an update if you go here to my contact. There will be new contact theater offered example two and 100 maybe money right. Okay. So like that we do here.

Got my point. Have any confusion Okay, so same way, we got to know how to read a bit. I'm saying very basic statements not advanced level right now. Okay? Basic SQL with a where condition limited by all these things. And this circle segment will practice more and more only like the main programs.

Let's write a trigger. And we will do many examples of triggers. I don't 10 triggers will write life. Okay, so that time we'll see what other segments we can pull, but I'm saying the very basics for that you will not scale afterwards. Okay, same way we did insert, update, delete, and offset. So now have you then got a scenario to merge?

Or what if I go to Account tab, I go and see there is something called more upon. So that means when I'm saying so many account, let's consider two accounts there is two accounts, which can be merged to one for anything So I had to work on which convert one account, that means one account deleted and one account updated like this you can do. So for these also we have database application in the cloud, you can use database that much. Let me show you all that records, then you can try one by one. See the moment I write I'm writing here database dot c equal March I have the month. So what is a collection of records on who is going to be the master record so out of two accounts, which is going to remain account nothing but let's see if I have anything here.

I don't have anything the test name. I'll just find a perfect name here to merge accounts. Let Burlington If any matching name comes then that will display only one icon if needed. So let's see I just typed something there. So let's try to do that already. So I can just create one icon with the feminine and then I'll try to merge so hard to see not to work on Kim, I want to merge it I select Next.

So these are production also we can do in banking. So out of this to account which account you want to keep, that is going to be master record, okay. And other than other information, you can merge it. So in that way, what you can do, same activities go in you want to do programmatically, we have a method, which is called a divisional match. If you see here, that merge, same way, you can use anything here. So going into database mode, it will tell me more estrogen How'd you do several agent you can manipulate modules.

Okay? That you can practice it. We're not clear on this okay? So let me go to another object here in the object I'm just going to lead object Okay. Now here I am writing once he looks different, okay, let's count family. If I do this single concerns it will return me the sum of the count of all records okay?

Same way. coin a like this one does not involve returning me in the integer vendor. So kill statement can return a collection of records in a single array. Or maybe in Pennsylvania. So now see, I want to see, see if you have any time upon the lead record, you will know me every lead record have a source. It may be emailed or maybe from WAV or maybe from anywhere depending on that picklist value what we have.

Let me go to my lead record, if you see, I may have many records, which are from different sources, or maybe we'll go to account if you go to account. Let me open a suti account here, a string alone. Okay, if you see I have different ratings. I may have many records, which are one, I may have many, many records, which are maybe cold, or maybe hot. I want to see how many records in the world. So now see what I'm going to do here.

I am writing one query on a counter apologetic. Okay. So what I want to get I want to see how many records I have in the rating object sorry in the account object with different rating. So one thing is reading count from account okay and I want to group by these on this setting grew by letting let's see, I have to copy the children let go to account copy this tree love everything correct diverting from our con, but I want to put this count of the name from account grew by rating now see I have hot account to warranty on call to something else. So whenever you want like the To remember the report and dashboard in the report, you do the summary report and then you add one field to group by group by sections, same way whenever you want to that kind of activity, you can use group by here also.

Okay? The making statements where they can be like, okay, that's normal conditions and the insert statements of District parents of such statements. Okay, so once we complete this, then we'll go to the core part of Salesforce okay. Till now you have any confusion. So, what is that count name bracket, which you have written, he, okay, these bracket. If you want you can keep this name field or not nothing but I'm just counting how many column helical if nothing would let's see, I just keep your, for example, integrated to this name column coming in this name column will come here.

UPC this name column will come. So I'm just counting these column if you want you can read it will not give me any dividends okay so it is counting the name column okay? Not nothing but how many columns for me when they will have algebra is time it will come in that way. Okay. Okay. Okay, so you just see these normal segments, okay.

Then we'll go to the core part of the Salesforce so that we can use all the things you talked about, we'll just learn how to form a word. Then now we'll go to learn complex statements. Okay, so we are going to write in many triggers a lot of course you're going to write okay. So I will write one code. So, the same way you can write two records by the day, okay. So any any question anything No, I'm good.

Okay, sorry. No, I'm good. Perfect. You practice this much. Okay, I am like I just am eligible to expend all this type game is different as everything it looks 10 there's no nothing hard to spend lots of time here. So same update DML insert equal access to an insert or everything the same way.

Just you need to understand what we're going to do it. Okay, so and we are going to use these simple simple statements always. Okay. So no worries. Just check it on the next lesson. We'll go for the next topic.

Okay. And if you have any questions, as always, feel free to message me. Or maybe you can mail me also. I'll respond. Always Don't worry for that. Okay.

Okay. Okay, perfect. So Pour today this much then we'll meet again in the next lesson. Thank you. Thank you for your time. Thank you might see

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.