filmov
tv
Salesforce Apex 18 | Database Class | Locking Statement | For Update | Try, Catch |
Показать описание
#SalesforceTryCatch #LockingStatement #DatabaseSaveResultInsert by Swapna @Swapna Salesforce
Apex Programming Session Links
*(Execution Methods, System Mode, User Mode, Update(), Parameters, Database Class Methods, Database.SaveResult(), Schema.SobjectField,)
*(SOQL Construct, Usage, Select, Order by, Where, Operators, Limit)
*(For Loop, Syntax, Primitive Data Type, Collection Data Type, Set, List)*
*(Datatypes, Primitive, Sobject, Collection, Enumeration, Variables, Local, Instance, Class, Constant, Assignment, Statements, Expressions, Loops, Do While, While, For)*
*****
Salesforce #Visualforce #Programming Session Links(01-07)
*****
Notes
27 August
Development :
Database Class
different Method
//insert opportunity -- Name, closeDate, Amount,stageName,AccountId
opp.Name='Console Apex5';
opp.Amount=1000;
opp.StageName='Prospecting';
opp.AccountId='0015j00000gPT4FAAW';
opp2.Name='Console Apex3';
opp2.Amount=1000;
opp2.AccountId='0015j00000gPT4FAAW';
ListOpportunity oppList = new ListOpportunityopp,opp2;
for(Database.SaveResult var : sr)
// insert, update,upsert
Exceptional statements : Apex statement, that captures error during the destruction of normal flow of code execution and takes corrective mesurement
try
Catch(Exception e)
try
if(Opp.Amount2000)
Catch(DMLException e)
9.Locking Statement : Apex allows a developers to lock object records while Developers are being updated in order to prevent execution conditoin
Keyword : FOR UPDATE
Account[] acc=[Select Id,name,Fax From Account where Id='0015j00000gPT4FAAW' FOR UPDATE];
acc[0].Fax='666666';
update acc[0];
for(Account acc: [Select Id From Account FOR UPDATE])
Assignement :
1.Create new mulitple records for Account
1 record -- has to have all mandatory information
2 record -- leave a 1 field which is mandatory
3 record -- has to have all mandatory information
4 record -- leave a mandatory information
5 records -- has to have all mandatory information
Disply the result of Non-Automic by passing the parameter "allOrNone == True, false,"
3.Update Rating= 'Cold' for first 10 Account Records and during the execution lock the records
Interview Questions :
01.What is Locking Statement ?
02.How Locking Statement is used at Code level ?
03.What is Keyword "FOR UPDATE" means ?
04.Explain Locking statement with Example ?
05.Explain try Catch with example?
06.What is Database.SaveResult ?
07.How to use Database.SaveResult ?
13.Explain recordsToUpdate?
Apex Programming Session Links
*(Execution Methods, System Mode, User Mode, Update(), Parameters, Database Class Methods, Database.SaveResult(), Schema.SobjectField,)
*(SOQL Construct, Usage, Select, Order by, Where, Operators, Limit)
*(For Loop, Syntax, Primitive Data Type, Collection Data Type, Set, List)*
*(Datatypes, Primitive, Sobject, Collection, Enumeration, Variables, Local, Instance, Class, Constant, Assignment, Statements, Expressions, Loops, Do While, While, For)*
*****
Salesforce #Visualforce #Programming Session Links(01-07)
*****
Notes
27 August
Development :
Database Class
different Method
//insert opportunity -- Name, closeDate, Amount,stageName,AccountId
opp.Name='Console Apex5';
opp.Amount=1000;
opp.StageName='Prospecting';
opp.AccountId='0015j00000gPT4FAAW';
opp2.Name='Console Apex3';
opp2.Amount=1000;
opp2.AccountId='0015j00000gPT4FAAW';
ListOpportunity oppList = new ListOpportunityopp,opp2;
for(Database.SaveResult var : sr)
// insert, update,upsert
Exceptional statements : Apex statement, that captures error during the destruction of normal flow of code execution and takes corrective mesurement
try
Catch(Exception e)
try
if(Opp.Amount2000)
Catch(DMLException e)
9.Locking Statement : Apex allows a developers to lock object records while Developers are being updated in order to prevent execution conditoin
Keyword : FOR UPDATE
Account[] acc=[Select Id,name,Fax From Account where Id='0015j00000gPT4FAAW' FOR UPDATE];
acc[0].Fax='666666';
update acc[0];
for(Account acc: [Select Id From Account FOR UPDATE])
Assignement :
1.Create new mulitple records for Account
1 record -- has to have all mandatory information
2 record -- leave a 1 field which is mandatory
3 record -- has to have all mandatory information
4 record -- leave a mandatory information
5 records -- has to have all mandatory information
Disply the result of Non-Automic by passing the parameter "allOrNone == True, false,"
3.Update Rating= 'Cold' for first 10 Account Records and during the execution lock the records
Interview Questions :
01.What is Locking Statement ?
02.How Locking Statement is used at Code level ?
03.What is Keyword "FOR UPDATE" means ?
04.Explain Locking statement with Example ?
05.Explain try Catch with example?
06.What is Database.SaveResult ?
07.How to use Database.SaveResult ?
13.Explain recordsToUpdate?