1) Salesforce provides two WSDL files, what are the differences?
Resolution:
Salesforce provides a WSDL (Web Service Description Language) files. They are called "Enterprise WSDL" and "Partner WSDL". A WSDL is an XML-document which contains a standardized description on how to communicate using a web service (the Salesforce API is exposed as a web service). The WSDL is used by developers to aid in the creation of Salesforce integration pieces. A typical process involves using the Development Environment (eg, Eclipse for Java, or Visual Studio for .Net) to consume the WSDL, and generate classes which are then referenced in the integration.
The primary differences between the two WSDL that we provide are:
Enterprise WSDL:
a) The Enterprise WSDL is strongly typed.
b) The Enterprise WSDL is tied (bound) to a specific configuration of Salesforce (ie. a specific organization's Salesforce configuration).
c) The Enterprise WSDL changes if modifications (e.g custom fields or custom objects) are made to an organization's Salesforce configuration.
For the reasons outlined above, the Enterprise WSDL is intended primarily for Customers.
Partner WSDL:
a) The Partner WSDL is loosely typed.
b) The Partner WSDL can be used to reflect against/interrogate any configuration of Salesforce (ie. any organization's Salesforce configuration).
c) The Partner WSDL is static, and hence does not change if modifications are made to an organization's Salesforce configuration.
For the reasons outlined above, the Partner WSDL is intended primarily for Partners.
To download a WSDL file when logged into Salesforce:
1. Click Setup | Develop | API
2. Click the link to download the appropriate WSDL. It will be something like: "Generate <type_of_wsdl> WSDL"
3. Save the file locally, giving the file a ".wsdl" extension.
Salesforce provides a WSDL (Web Service Description Language) files. They are called "Enterprise WSDL" and "Partner WSDL". A WSDL is an XML-document which contains a standardized description on how to communicate using a web service (the Salesforce API is exposed as a web service). The WSDL is used by developers to aid in the creation of Salesforce integration pieces. A typical process involves using the Development Environment (eg, Eclipse for Java, or Visual Studio for .Net) to consume the WSDL, and generate classes which are then referenced in the integration.
The primary differences between the two WSDL that we provide are:
Enterprise WSDL:
a) The Enterprise WSDL is strongly typed.
b) The Enterprise WSDL is tied (bound) to a specific configuration of Salesforce (ie. a specific organization's Salesforce configuration).
c) The Enterprise WSDL changes if modifications (e.g custom fields or custom objects) are made to an organization's Salesforce configuration.
For the reasons outlined above, the Enterprise WSDL is intended primarily for Customers.
Partner WSDL:
a) The Partner WSDL is loosely typed.
b) The Partner WSDL can be used to reflect against/interrogate any configuration of Salesforce (ie. any organization's Salesforce configuration).
c) The Partner WSDL is static, and hence does not change if modifications are made to an organization's Salesforce configuration.
For the reasons outlined above, the Partner WSDL is intended primarily for Partners.
To download a WSDL file when logged into Salesforce:
1. Click Setup | Develop | API
2. Click the link to download the appropriate WSDL. It will be something like: "Generate <type_of_wsdl> WSDL"
3. Save the file locally, giving the file a ".wsdl" extension.
2) I have created a batch process. Let say I have thousands of records to process. Now what i want is when there is an error
encounter or some problem found in the data during the batch process, I want to stop or abort the batch process. Is it possible ?
encounter or some problem found in the data during the batch process, I want to stop or abort the batch process. Is it possible ?
ANS: public void execute(Database.BatchableContext bc, List<SObject> scope) {
try {
...
}
catch (Exception e) {
// Report errors here
System.abortJob(bc.getJobId());
}
}
}
3) If Run a Batch classe some records would be failed Now how to recover that failed records.?
using below method we can.
Database.SaveResult[] SaveResultList = Database.insert(accts,false);
Database.SaveResult[] SaveResultList = Database.insert(accts,false);
4) Schedule apex to run every 10 Min..??
You have to schedule your batch for 6 times, if you want to run batch for every 10 mints.
System.schedule('Scheduled Job 1', '0 0 * * * ?', new scheduledTest());
System.schedule('Scheduled Job 2', '0 10 * * * ?', new scheduledTest());
System.schedule('Scheduled Job 3', '0 20 * * * ?', new scheduledTest());
System.schedule('Scheduled Job 4', '0 30 * * * ?', new scheduledTest());
System.schedule('Scheduled Job 5', '0 40 * * * ?', new scheduledTest());
System.schedule('Scheduled Job 6', '0 50 * * * ?', new scheduledTest());
5) The difference between regular (non-static) and static methods
Java is a Object Oriented Programming(OOP) language, which means we need objects to access methods and variables inside of a class. However this is not always true.
Java is a Object Oriented Programming(OOP) language, which means we need objects to access methods and variables inside of a class. However this is not always true.
While discussing static keyword in java, we learned that static members are class level and can be accessed directly without any instance.
In this article we will see the difference between static and non-static methods.
Static Method Example
class StaticDemo
{
Static Method Example
class StaticDemo
{
public static void copyArg(String str1, String str2)
{
//copies argument 2 to arg1
str2 = str1;
System.out.println("First String arg is: "+str1);
System.out.println("cond String arg is: "+str2);
}
{
//copies argument 2 to arg1
str2 = str1;
System.out.println("First String arg is: "+str1);
System.out.println("cond String arg is: "+str2);
}
public static void main(String agrs[])
{
/* This statement can also be written like this:
* StaticDemo.copyArg("XYZ", "ABC");
*/
{
/* This statement can also be written like this:
* StaticDemo.copyArg("XYZ", "ABC");
*/
copyArg("XYZ", "ABC");
}
}
}
Output:
First String arg is: XYZ
Second String arg is: XYZ
As you can see in the above example that for calling static method, I didn’t use any object. It can be accessed directly or by using class name as mentioned in the comments.
Non-static method example
class JavaExample
{
public void display()
{
System.out.println("non-static method");
}
public static void main(String agrs[])
{
JavaExample obj=new JavaExample();
/* If you try to access it directly like this:
* display() then you will get compilation error
*/
obj.display();
}
}
Output:
non-static method
A non-static method is always accessed using the object of class as shown in the above example.
Notes:
How to call static methods: direct or using class name:
StaticDemo.copyArg(s1, s2);
OR copyArg(s1, s2);
How to call a non-static method: using object of the class:
JavaExample obj = new JavaExample();
Important Points:
Static Methods can access static variables without any objects, however non-static methods and non-static variables can only be accessed using objects.
Static methods can be accessed directly in static and non-static methods. For example the static public static void main() method can access the other static methods directly. Also a non-static regular method can access static methods directly.
First String arg is: XYZ
Second String arg is: XYZ
As you can see in the above example that for calling static method, I didn’t use any object. It can be accessed directly or by using class name as mentioned in the comments.
Non-static method example
class JavaExample
{
public void display()
{
System.out.println("non-static method");
}
public static void main(String agrs[])
{
JavaExample obj=new JavaExample();
/* If you try to access it directly like this:
* display() then you will get compilation error
*/
obj.display();
}
}
Output:
non-static method
A non-static method is always accessed using the object of class as shown in the above example.
Notes:
How to call static methods: direct or using class name:
StaticDemo.copyArg(s1, s2);
OR copyArg(s1, s2);
How to call a non-static method: using object of the class:
JavaExample obj = new JavaExample();
Important Points:
Static Methods can access static variables without any objects, however non-static methods and non-static variables can only be accessed using objects.
Static methods can be accessed directly in static and non-static methods. For example the static public static void main() method can access the other static methods directly. Also a non-static regular method can access static methods directly.
6) Best Practices for Improving Visualforce Performance
>> Cache any data that is frequently accessed, such as icon graphics.
>> Cache any data that is frequently accessed, such as icon graphics.
>> Avoid SOQL queries in your Apex controller getter methods.
>> Reduce the number of records displayed on a page
>> “Lazy load” Apex objects to reduce request times.
>> Consider moving any JavaScript outside of the <apex:includeScript> tag and placing it in a <script> tag
28. What are the Best Practises for Improving Visualforce Performance ?
Answer:
1) The view state size of your Visualforce pages must be under 135 KB. By reducing your view state size, your pages can load quicker and stall less often.
2) Large page sizes directly affects load times. To improve Visualforce page load times:
· Cache any data that is frequently accessed, such as icon graphics.
· Avoid SOQL queries in your Apex controller getter methods.
· Reduce the number of records displayed on a page by adding filter condition in SOQL
3) Reduce Multiple Concurrent Requests: use <apex:actionpoller>
4) By using the with sharing keyword when creating your Apex controllers, you have the possibility of improving your SOQL queries by only viewing a data set for a single user.
see More: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_best_practices_performance.htm
7)I need to ascending order of following strings based on first name manu yadav, ann reddy, paa goud how can you achive this.
list<string> str = new list<string>();
str.add('manu yadav');
str.add('ann reddy');
str.add('paa goud');
str.sort();
system.debug('the list of names'+str);
8) Below is the Salesforce Order of Execution:
System Validation rule (required field, field format) (SV)
Before Triggers are executed (BT)
Custom Validation rules are checked (CV)
After Triggers are executed (AT)
Assignment Rules are executed (AR)
Auto-Response Rules are executed (ARR)
Workflow Rules are executed (WR)
Before and after triggers are executed one more time if the workflow rule updates a field (BT & AT)
Escalation Rules are executed (ER)
Parent Rollup Summary Formula or Cross Object Formula fields are updated in the respective objects. (RSF, COF)
(These parent records also goes through the entire execution order)
Criteria Based Sharing rules are evaluated (CBS)
Any Post-Commit Logic is executed (PCL)
(like sending an email)
Below will help you to remember Order of Execution in Salesforce:
SV -> BT -> CV -> AT -> AR -> ARR -> WR (BT, AT) -> ER -> RSF, COF -> CBS -> PCL
SV -> BT -> CV -> AT -> AR -> ARR -> WR (BT, AT) -> ER -> RSF, COF -> CBS -> PCL
NICE BOST
ReplyDelete