Sandbox environment can be accessed using https://test.salesforce.com
Sandbox environment can be accessed using https://test.salesforce.com
public Pagereference method1()
{
return null;
}
PageReference pageRef = new PageReference( '/apex/myVfPage' ); |
pageRef.setRedirect( true ); |
pageRef.getParameters().put( 'myId' , accId); //Assume accId is a variable in class or method |
So, overall code will look like
public PageReference redirectToMyVF(Id accId) {
PageReference myVFPage = new PageReference('/apex/myVFPage')
myVFPage.setRedirect(true);
myVFPage.getParameters().put('myId', accId);
return myVFPage;
}
2. What is the situation to use the pagereference?
– When you want to jump to other VF page when something is clicked and method takes you to new VF page or refreshing current page by doing “return null;”
Use a StandardController when defining an extension for a standard controller.
StandardController objects reference the pre-built Visualforce controllers provided by Salesforce. The only time it is necessary to refer to a StandardController object is when defining an extension for a standard controller. StandardController is the data type of the single argument in the extension class constructor.
You can instantiate a StandardController in the following way:
—
JSON is a lightweight data-interchange format. It is the most preferred way of transferring data over web.
In Salesforce, this comes to most use when integrating with an external system.
In most of the integrations, you typically use HTTP Callouts to the end points defined by various services, and the most common response format returned by these is JSON.
Now, parsing this JSON would be very time consuming if not done in the right way. One way of doing this would be manually parsing the complete JSON using the JSONParser method.
But the easiest way of Parsing JSON would be to de-serialize it into an Object.
Use the with sharing or without sharingkeywords on a class to specify whether or not to enforce sharing rules.
The with sharing keyword allows you to specify that the sharing rules for the current user be taken into account for a class. You have to explicitly set this keyword for the class because Apex code runs in system context. In system context, Apex code has access to all objects and fields— object permissions, field-level security, sharing rules aren’t applied for the current user. This is to ensure that code won’t fail to run because of hidden fields or objects for a user. The only exceptions to this rule are Apex code that is executed with the executeAnonymous call and Chatter in Apex. executeAnonymous always executes using the full permissions of the current user. For more information on executeAnonymous, see Anonymous Blocks.
Use the with sharing keywords when declaring a class to enforce the sharing rules that apply to the current user. For example:
1 |
public with sharing class sharingClass { |
2 |
3 |
// Code here |
4 |
5 |
} |
Use the without sharing keywords when declaring a class to ensure that the sharing rules for the current user are not enforced. For example, you may want to explicitly turn off sharing rule enforcement when a class acquires sharing rules when it is called from another class that is declared using with sharing.
1 |
public without sharing class noSharing { |
2 |
3 |
// Code here |
4 |
5 |
} |
Some things to note about sharing keywords:
Apex offers multiple ways for running your Apex code asynchronously.
In computer programs, asynchronous operation means that a process operates independently of other processes.
In this article, we will be loking at Batch Apex.
Batch Apex is useful to build complex, long-running processes that run on thousands of records on the Force.com platform. Batch Apex operates over small batches of records, covering your entire record set and breaking the processing down to manageable chunks.
Lets take a scenario . Say i have some thousands of records that contain information about a product like product name, category(furniture, electronics etc.), product container etc..
I got a requirement to change the product container name from Medium Box to Medium Size Box pertaining to a particular product called Furniture. Lets see how to achieve this using Batch Apex. Continue reading
Lets look at retrieving child data from Parent object
An Example:
public class SOQLParentChildQueryExample { public List accs {set;get;} public void standardObjectStandardLookup(){ flag1=true; flag2=false; accs=[select name,Industry ,(select lastName,firstName from Contacts) from Account]; // //Contacts is the standard relation name defined by sfdc. } public void standardObjectCustomLookup(){ flag1=false; flag2=true; accs=[select name,Industry , (select lastName,firstName from CustomAccountRelation__r) from Account where Industry='Energy']; //CustomAccountRelation is the custom relation name defined by user. So __r is required. } }
–
In this article, lets look at how to retrieve query results in two related objects.
Child to Parent scenario is:
PField -parent field
CField-Child field
RField – Relationship field
Salesforce created standard relation name can be directly used whereas custom relation name should be appended by __r.
Lets look at an example:
public class SOQLChildParentQueryExample { public List cons {set;get;} public void standardObjectStandardLookup(){ cons=[select lastName,firstName , Account.name,Account.Industry from Contact]; // Account is the standard relation lookup field name defined by sfdc. } public void standardObjectCustomLookup(){ cons=[select lastName,firstName , CustomAccount__r.name, CustomAccount__r.Industry from Contact ]; //CustomAccount is the custom relation lookup field name defined by user. //So __r is required. } }
Hi in this article we look into Aggregate functions in SOQL.
Aggregate functions are : SUM , AVG,MAX,MIN,COUNT.
Lets look at an example.
we can access one instance from one id at a time.
AP | NA | EU | CS are the possible instances for salesforce.
any environment will have a URL like https://na12.salesforce.com (example), which may vary depending on the location of the organization.
AP | NA | EU – Production Environment Instances
CS – Sandbox Environment Instances