Standard Controller Actions: Retrieve and Update All The Records/single Record From Object-With Icon - 9 Video
Standard Controller Actions: Retrieve and Update All The Records/single Record From Object-With Icon - 9 Video
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_std_actions.htm
<apex:pageblockSection title="Output">
<apex:pageblockSectionItem >
<apex:outputLabel value="Naresh" for="Item"/>
<apex:inputField value="{!Account.Ownership}" id="Item"/>
</apex:pageblockSectionItem>
<p>PageblockItem</p><br/>
</apex:pageblockSection>
<apex:pageblockButtons location="top">
<apex:commandButton action="{!Save}" value="Save"/>
<apex:commandButton action="{!quicksave}" value="quicksave"/>
<apex:commandButton action="{!edit}" value="edit"/>
</apex:pageblockButtons>
</apex:pageblock>
</apex:form>
Pageblocksetion Item:
We cant use morethan 2 tags within this tag.
Global Variables
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global.htm
Retrieve and Update all the records/Single record from object—with icon---9 th Video
<apex:page showHeader="false" standardController="Account" recordSetVar="Acclist">
<apex:form >
<apex:pageBlock >
<apex:facet name="header">
<div class="content">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQWTQRRzHL9-pEoN90jOp2WWeBoYFVbkBidHobUqeRyHqIFjiKb"
class="pageTitleIcon" />
</div>
<div class="pbTitle">
<h3>Account</h3>
</div>
</apex:facet>
<apex:pageblockTable value="{!Acclist}" var="Acc">
<apex:column value="{!Acc.name}"/>
<apex:column value="{!Acc.site}"/>
<apex:column value="{!Acc.Accountnumber}"/>
<apex:column headerValue="Industry">
<apex:inputfield value="{!Acc.industry}"/>
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Repeat:
17th: Methods:
3 types:
1) Void method
2) Return methods.
again 2 types
Primitive and non primitive return method(Sobj,standard obj , custom obj,classes)
3) Page reference method--It iwll cover in controller topic.
Void :
Syntax:
public void method(){
}
return:
public pri/non pri datatype method(){
return value;
}
The variables which are declared within the class will not access from the outside.
We can call a method from any other method
Method Arguments:
Methods Argu are similar to the constructor arg.
Utility class:
Utility classes are helper classes that consists of reusable methods.
Utiltity class-1
public class Utilityclass_20 { //--Utility class is a helper class which contains reusable methods.
Utility class-2:
public class Utilityclass_1_20 {
public void insertmethod(){
Utilityclass_20 ut=new Utilityclass_20();
account a = ut.returnaccount('Naresh Ut2','DVK');
insert a;
contact cc=ut.returncont(a.id,'Hony','Sweety');
insert cc;
}
}
Inner class:
Inner class is a class which is written within the class.
We can use inner class as a wrapper class in VF pages to combine the different data types.
We can call the Inner class in 3 ways.
1) From the main class.
2) From outside of the class
3) From the other inner class of the same main class.
From the Main class:
https://micropyramid.com/blog/how-to-use-list-methods-in-salesforce/
Set: 25th Video
Conversion:
Converting from a List to Set, can be done using the set’s constructor.
Converting from a Set to a List, can be done using the List constructor.
1) First Approach
Set<String> sStrings = new Set<String>{'a','b','c','d','e'};
List<String> lStrings = new List<String>(sStrings);
--------------------------------------------------------------------------
2) Second approach
Set<String> sStrings = new Set<String>{'a','b','c','d','e'};
List<String> lStrings = new List<String>();
lStrings.addall(sStrings);
Program:
list<account> al;
for(integer i=0;i<5;i++){
a.name='ooo1' +i;
a.site='set2';
accset.add(a);
system.debug('accset==>' +al);
insert al;
return al;
}
Maps:26,27,28.
Map is a collection of class, which consists a group of elements. It is a key and value pair. Each and every element in the map contains key and value.
Key should be unique and value can be duplicated. It supports dynamic memory allocation. It's like a collection of Key-value pair, where each
key(unique) map to a single value. Keys and values can be any data types.
Calling:
classname.staticmethod();
if we execute static method , it will execute only static variables and it skips constructor and normal variables.
//Private variables can access within the same class only.Will not work outside of the
class(Another class).
public class Private_variable_30 {
private string str='Naresh';
system.debug('Str==>' +str);
}
}
VF controller 30:
1) Standard controller.
2) Custom controller
3) Extension controller.
Standard controller : Standard Controller in Salesforce are used in visualforce page. These controllers are available for both standard
and custom objects. The main aim of these standard controllers are to provide standard functions like Save, Delete and Create records.
https://www.tutorialkart.com/visualforce/standard-controller-in-salesforce-standardcontroller-attribute/
Custom Controllers:
A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom
controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-
level security of the current user.
If we are using Sobjects setter method is not required. We have to use setter method for primitive data types.
Getter: Get (getter) method is used to pass the value from controller(Apex) to VF page.
Developer Sandbox:(Local)
A Developer sandbox is intended for development and testing in an isolated environment. A Developer Sandbox includes a copy of your production
org’s configuration (metadata).
A Developer sandbox is intended for development and testing in an isolated environment. A Developer Sandbox includes a copy of your production
org’s configuration (metadata).Use a Developer Pro sandbox to handle more development and quality assurance tasks and for integration testing or
user training.
A Partial Copy sandbox is intended to be used as a testing environment. This environment includes a copy of your production org’s configuration
(metadata). Use a Partial Copy sandbox for quality assurance tasks such as user acceptance testing, integration testing, and training.
Full Sandbox:
A Full sandbox is intended to be used as a testing environment. Only Full sandboxes support performance testing, load testing, and staging. Full
sandboxes are a replica of your production org, including all data, such as object records and attachments, and metadata. The length of the refresh
interval makes it difficult to use Full sandboxes for development.
The records we can move from one org to antoher org with the help of Data loader.
2) ANT
3) changesets(Salesforce inbuilt)
ANT:
Wehave 2 files .
1) build.properties:
3) build.xml:
Retrive build:
database.insert(acc);
Search_global_3:
Export_to_excel.
Class 36:
Rendared:
Generally we will use the Rendared to Hide or Disaplay the elements.Generaly we will use in Pageblock, Pageblocksections,output panels.
Param:
1. Most importantly, they are Metadata and thus deployable! No more annoying configuration after deployment, which you have to do with Custom
Settings. They're also refreshed to sandboxes, so you don't need to create Apex classes to generate your default Custom Setting records.
2. They have WAY more options that Custom Settings: picklist fields, long text areas (in Spring '17), page layouts, and validation rules (though as of
Winter '17 these are not deployable either by change set or by migration tool - weird!)
3. The beauty that is Metadata Relationships! You can create lookups between Custom Metadata objects. Additionally, you can create an Object
Definition lookup - so you're relating Custom Metadata to Standard or Custom Object definitions.
============
1. Hierarchies - Custom metadata types do not purport to replace hierarchy custom settings which allow you to vary values based on users and
profiles across the org. These custom settings can also be referenced in formulas, so can be used in formula fields, validation rules, workflow rules,
and visualforce. (Documentation here).
Custom setting records’ values can be edited in code, while custom metadata cannot. If you will need to modify your configuration programmatically
for any reason (say you’re creating a config console for the user), custom metadata will not work.
If we deploy custom settings only obj will deploy records wont deploy, we have to create again custom records in another enviroment.We can
overcome this problem with custom metadatypes.
Extension Controller in Salesforce is an Apex class containing a constructor that is used to add or extend the functionalities of a Standard
Controller or custom controller in Salesforce.
Extension controller is also used to leverage the functionality of another controller using our own custom logic.
We can
1) Override the buttons
2) Create custom buttons
3) Create tabs.
We can use this extension controller with standard controller and custom controller.
For standard controller we have to use Apexpages.standardcontroller variable.
Javascript Basics-41:
Object creation in Javascript:
<head>
<body>
<script type="text/javascript">
var sobject = {
Name :'Naresh',
Mobile:'789654131',
Address:'Hyderabd',
};
console.log('Object Name==>'+sobject.Name);
console.log('Object Name==>'+sobject.Mobile);
console.log('Object Name==>'+sobject.Address);
</script>
</body>
</head>
</apex:page>
console.log('Filed Name==>'+std);
console.log('Filed values==>'+sobject[std]);
}
Javascript-43:
1) alert
2) Validation
3) Add JS file into salesforce static resource.
alert:
<apex:form id="form">
<apex:pageBlock id="pb">
</div>
<apex:pageBlockSection id="ps">
<apex:inputField value="{!Account.name}"/>
<apex:inputField value="{!Account.industry}"/>
<apex:inputField value="{!Account.rating}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript">
function Alertfunction(){
if(stee.value !='hyderabad'){
return false;
}
}
</script>
</apex:page>
Validation Msg:
<apex:form id="form">
<apex:pageBlock id="pb">
</div>
<apex:pageBlockSection id="ps">
<apex:inputField value="{!Account.name}"/>
<apex:inputField value="{!Account.industry}"/>
<apex:inputField value="{!Account.rating}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<script type="text/javascript">
function Alertfunction(){
if(stee.value !='hyderabad'){
para.appendChild(node);
element.appendChild(para);
return false;
}
}
</script>
</apex:page>
<apex:includeScript value="{!$Resource.example_js}"/>
Setpagesize
val=5;
std.setpagesize(val);
std.setpagesize(val);
acclist=(list<account>)std.getrecords();
std.First();
acclist=(list<account>)std.getrecords();
std.previous();
acclist=(list<account>)std.getrecords();
std.next();
acclist=(list<account>)std.getrecords();
std.last();
acclist=(list<account>)std.getrecords();
return std.getHasNext();
return std.getHasPrevious();
VF Webcomponent 46:
Triggers 47:
Triggers only works on DML operattions.
It will executte based on events(before insert, after insert)
triggers have context variables
divided into 2 types
before and After
Handler class:
Writitng total logic in Apex lass and calling this class in Triggers.
It is a separate transaction.
Future method doesnot support non primitive datatypes.