- Book1
- Book2
- Salesforce Interview questions
- General Interview Questions
- Scenario Based Interview Questions
- Admin Interview Questions
- Apex Interview Questions
- Good Interview Questions
- Prepared FAQ's
Salesforce
APEX
- Apex is an object-oriented programming written in discrete components and executed by the Force.com Platform.
- It runs natively on the Salesforce servers, making it more powerful and faster than non-server code, such as JavaScript/AJAX.
- It uses syntax that looks like Java.
- It has built-in support for unit test creation and execution
Apex Code is abstracted and governed, utilizing only as many resources as is allowed.
Action Methods:
<apex:commandButton> •creates a button that calls an action
<apex:commandLink> •creates a link that calls an action
<apex:actionPoller> •periodically calls an action
<apex:actionSupport> •create an event •Onclick •Onmouseover, etc.. •For another, named component to call an action
Custom settings?
Custom setting that provides a reusable set of static data that can be accessed across your organization. Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user.
All custom settings data is exposed in the application cache, which enables efficient access.
Without the cost of repeated queries to the database.
This data can then be used by formula fields, validation rules, Apex, and the Web services API.
There are two types of custom settings
Can a Checkbox as controlling field?
Checkbox fields can be controlling fields but not dependent fields.
Multi select fields can be dependent pick lists but not controlling fields.
Picklist Limitations:
Custom picklist fields can be either controlling or dependent fields.
Standard picklist fields can be controlling fields but not dependent fields.
The max no. of values allowed in a controlling field is 300
Controller :
- Controllers contain Apex, that defines how pages interact with each other, and the rest of the platform
- Ability to reuse any standard Salesforce UI behavior like new, edit, save, etc (standard controller) and have access to Salesforce data.
- Ability to define new UI behaviors and navigation using Apex (custom controller).
- Developers can use Standard Controllers (generated automatically for all Standard and Custom Objects) to implement standard Salesforce behavior (Save, Delete etc) on Visualforce Pages.
- Custom Controllers to implement custom behavior.
Custom Controllers
- A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller.
- Use controller extensions when:
- You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
- Controller extension is very useful and important concept introduced by the salesforce recently. It gives the power to programmer to extend the functionality of existing custom controller or standard controller.
- A Visualforce can have a single Custom controller or standard controller but many controller extensions
Visualforce Controllers
- Controllers contain the logic and data references a page uses
- Separates presentation from logic
- Created in Apex code providing full access to Apex functionality (API, Web services, etc.)
- Pages interact with controllers through components
- Maintain state across page interactions
- Standard controllers implement normal app behavior (view, edit, save, etc)
--
Parent to Child
list<Contact> c= [SELECT Contact.FirstName, Contact.Account.Name from Contact];
Child to parent:
list<Account> acc=[SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts) FROM Account];
SOQL(Salesforce Object Query Language)
1)Using SOQL we can Search only on one object at a time.
2)We can query on all fields of any datatype
3)We can use SOQL in Triggers and classes.
4)We can perform DML operation on query results.
SOSL(Salesforce object Search Language)
1)Using SOSL we can search on many objects at a time.
2)We can query only on fields whose data type is text, phone and Email.
3)We can use in classes but not in Triggers.
4)We cannot perform DML operation on search result
In each specified relationship, no more than five levels can be specified in a child-to-parent relationship
When to use SOQL and SOSL click here
Salesforce Object Search Language (SOSL)
- Use the Salesforce Object Search Language (SOSL) to construct text searches from any number of related or non-related objects.
SOSL statements evaluate to a list of lists of sObjects, where each list contains the search results for a particular sObject type.
- The result lists are always returned in the same order as they were specified in the SOSL query.
List<List<SObject>> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (id, name), Contact, Opportunity, Lead];
DML - merge
- The merge statement merges up to three records of the same type into one of the records, deleting the others, and re- parenting any related records.
- Only leads, contacts, and accounts can be merged.
Data Manipulation Language
- Data manipulation language (DML) operations can be used to retrieve, insert, delete, and update data in a database.
- You can execute DML operations using two different forms:
- Standalone Apex DML statements, such as:
- insert(SObject);
- insert SObject[];
- Apex DML database methods, such as:
Database.SaveResult[] result = Database.Insert(SObject[]);
DML Operations : convertLead ,Delete ,Insert ,Merge, Undelete ,Update ,upsert
Using Database class methods: The advantage of using the Database class method is that you have access to the optional allOrNone parameter to specify whether the operation can partially succeed. When this parameter is set to false, if an error occurs on a partial set of records, the successful records are committed.
PermissionSet represents a set of permissions that’s used to grant additional access to one or more users without changing their profile or reassigning profiles. You can use permission sets to grant access, but not to deny access.
SOQL Injection
- Apex does not use SQL, but uses its own database query language, SOQL
- SQL/SOQL injection involves taking user-supplied input and using those values in a dynamic SOQL query. If the input is not validated, it can include SOQL commands that effectively modify the SOQL statement and trick the application into performing unintended commands. A SOQL Injection flaw can be used to modify the intended logic of any vulnerable query.
- To prevent a SOQL injection attack, avoid using dynamic SOQL queries. Instead, use static queries and binding variables.
- If you must use dynamic SOQL, use the escapeSingleQuotes method to sanitize user-supplied input.
- you can use to prevent SOQL injection like:
- Type casting
- Replacing characters
- Whitelisting
For more info click here Example program: SOQLController apex/VF
Lead Management
- Track marketing campaigns across all channels.
- Convert more leads into actual opportunities.
- Route and assign leads to the right people
- Align sales and marketing teams
- Map out your sales process
- Define clear hand-off criteria between marketing and sales
- Define success metrics up front
- Capture more leads
- Capture leads automatically
- Use web-to-lead forms
- Use Twitter
- Import leads
- Enter leads manually
- Keep data clean
- Clean your leads regularly
- Use validation rules
- Work leads efficiently
- Prioritize leads with lead scoring
- Categorize scored leads
- Use assignment rules to route leads
- Track lead generation efforts
- Identify and track lead sources
- Use the Lead history report to analyze revenue and pipeline
- Use campaign for deeper metrics
- Use reports and dashboards
Case Management
Case is a descriptions of customer’s feedback, question or questions, enquiry and use cases to track and solve your customer issues
Route case ownership with queues.
Never allow cases to fall through the cracks
Assign cases automatically.
Respond to customers automatically.
Escalate cases when necessary.
Queuesà automatically prioritize your support team’s workload by creating lists from which specific agents can jump in to solve certain types of cases.
Assignment Rulesà automatically assign incoming cases to specific agents so that the right people work on the right cases.
Auto-Response Ruleà Automatically send personalized email responses to customers based on each case’s details.
Escalation Rulesà automatically escalate cases to the right people when the cases aren’t solved by a certain time.
Macrosà Automatically complete repetitive tasks on cases, such as selecting the right email templates, so that agents can spend time doing more important things. Email Services
Your customers can log their own cases from a community, Customer Portal, Self-Service portal, or Chatter Answers.
– Outbound Email
--> You can use Apex to send individual and mass email.
--> The email can include all standard email attributes (such as subject line and BCC address), use Salesforce email templates, and be in plain text or HTML format, or those generated by Visualforce.
--> To send individual and mass email with Apex, use the following classes:
- SingleEmailMessage
- Instantiates an email object used for sending a single email message. The syntax is:
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
- MassEmailMessage
-Inbound Email
Email services are automated processes that use Apex classes to process the contents, headers, and attachments of inbound email. For example, you can create an email service that automatically creates contact records based on contact information in messages. Each email service has one or more email service addresses that can receive messages for processing.
Before creating email services, create Apex classes that implement the Messaging.InboundEmailHandler interface.
global class myHandler implements Messaging.InboundEmailHandler{
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
return result; } }
**Outbound Email: Limits for Single and Mass Email Sent Using Apex
Using the API or Apex, you can send single emails to a maximum of 5,000 external email addresses per day based on (GMT)
When sending single emails, keep in mind:
You can specify up to 100 recipients for the To field and up to 25 recipients for the CC and BCC fields in each SingleEmailMessage.
If you use SingleEmailMessage to email your org’s internal users, specifying the user’s ID in setTargetObjectId means the email doesn’t count toward the daily limit
Custom components?
- Encapsulate a common design pattern in a custom component to reuse that component in Visualforce pages.
- Create Standard UI elements, such as detail areas and related lists, with a single tag
Built in data binding
--> Similar to methods in a class.
--> Simple Example:
<apex:component>
<apex:outputText value="This is my custom component."/>
</apex:component>
What to Test? --> Single action --> Bulk actions--> Positive behavior --> Negative behavior --> restricted user--> handle exception properly
Using runAs Method
--> Generally, all Apex scripts run in system mode, and the permissions and record sharing of the current user are not taken into account.
--> The system method runAs enables you to write test methods that change either the user contexts to an existing user or a new user.
--> You can only use runAs in a test method.
--> Only 20 calls to runAs specifying a user are allowed in a transaction.
Governors and Limits
--> Governor Limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multi-tenant environment
Future Annotation
Use the future annotation to identify methods that are executed asynchronously.
The method executes when Salesforce has available resources.
Must be static method and can only return be void.
When Example:
Use the future annotation when making an asynchronous Web service callout to an external service.
The reason why sObjects can’t be passed as arguments to future methods is because the sObject might change between the time you call the method and the time it executes. In this case, the future method will get the old sObject values and might overwrite them. To work with sObjects that already exist in the database, pass the sObject ID instead (or collection of IDs) and use the ID to perform a query for the most up-to-date record. The following example shows how to do so with a list of IDs
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htm
Ex:
global class MyFutureClass {
@future (callout=true)
static void myMethod(String a, Integer i) { System.debug('Method called with: ' + a + ' and ' + i);
//do callout, other long running code } }
GL
No more than 10 method calls per Apex invocation.
200 method calls per full Salesforce user license in 24 hours.
Parameters specified must be primitive dataypes, arrays of primitive datatypes, or collections of primitive datatypes.
Cannot take sObjects or objects as arguments.
Cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor
RecordSetvar: It used to get the set of records from the standard controller.
PageBlockTable:
PageBlockTable should be define inside pageblock or pageblocksection.
PageBlockTable uses standard styles sheets to design a visual page.
It has the required attribute "value".
Column headers will be displayed automatically.
DataTable:
No need to write inside pageblock or pageblocksection.
There is no required value.
The data can be displayed using custom style sheets.
We need to specify column headers explicitly.
Repeater:
There is no proper alignment of data in repeater compared with DataTable.
there is no javascript events like onmouseover, onclick
What is a Queue?
A: Queue contains group of records Group of people can access those records.
Records will be in a queue until accepts them for a processing by a group member otherwise they moved to another place.
Approval Process: allocate approval dynamically to the record .populate the approval in the user lookup fields in the record.
WorkFlow:
- Workflow is point and click which doesn't need any coding.
- Inbuilt functionality, used on single object, related object(M_D)
- Here we can’t do DML operation using Workflow.
- Workflows work only after some actions
- we can make a workflow for based on time, whereas trigger cannot
Workflow Rule
A workflow rule sets workflow actions into motion when its designated conditions are met. Workflow is automated process that fired an action based on Evaluation criteria and rule criteria.
You can configure workflow actions to execute immediately when a record meets the conditions in your workflow rule, or set time triggers that execute the workflow actions on a specific day.
Action - Non code based whereby you want the system to do something i.e. Send an Email or Update a Field
- Synchronous workflows run and hold you up until they're complete –
- the workflow starts immediately, and
- the user has to wait for the workflow to be completed
- Async workflows run in the background –
- the execution would not start immediately, and
- the user does not have to wait until the workflow completes
Approval Process
An approval process is an automated process your organization can use to approve records in Salesforce.com. An approval process also specifies the actions to take when a record is approved, rejected, recalled, or first submitted for approval.
Workflow and approval actions consist of email alerts, tasks, field updates, and outbound messages that can be triggered by a workflow rule or approval process.
Process builder
- we can perform more actions then the workflow
- Can add multiple workflows based on different criteria.
- Process builder are many more powerful then workflows.
- You can build complex processes using Process Builder.
- we have different workflow based on different criteria
- we can disable and delete the process builder
Create record, Update any related record, and Use a quick action to create a record, log a call, Call apex methods, Post to Chatter, Launch a flow
Trigger:
- Salesforce automatically fires active triggers when the specified database events occur .You can call it as advance version of Workflow.
- Trigger works across all the objects.
- You can create a new record through trigger which is not possible through workflow.
- Whenever we do DML operations like (insert, update, delete ) then you go for Trigger concept
- Trigger works before and after some actions, Coding is required
- Triggers fire before workflows
- Invoking Callouts Using Apex(Call a class method from a trigger)
- Use triggers to perform operations based on specific conditions, to modify related records or restrict certain operations from happening
- Triggers are stored as metadata in Salesforce.com
- Use the sObject addError() method in a trigger to restrict save operations
- Calling addError() in a trigger causes the entire set of operations to roll back, except when bulk DML is called with partial success
Batch Apex
- Batch Apex is exposed as an interface that must be implemented within Apex Class.
- Used to build complex, long running processes on the Force.com platform.
- Can also be programmatically scheduled to run at specific times using the Apex scheduler.
- Example: Update the owner of all the Account records in the System.
- Testing Batch Apex
- Can test only ONE execution of the execute method.
- executeBatch method starts an asynchronous process. Make certain that the batch job is finished before testing against the results.
- Use the Test methods startTest and stopTest around the executeBatch method to ensure it finishes before continuing your Test
Start Method/Execute Method/Finish Method
global (Database.QueryLocator | Iterable<sObject>) start(Database.BatchableContext bc) {}
global void execute(Database.BatchableContext BC, list<P>){}
global void finish(Database.BatchableContext BC){}
QueryLocator:
When you’re using a simple query (SELECT) to generate the scope of objects in the batch job. The governor limit for the total number of records retrieved by SOQL queries is bypassed
Iterable:
Use the iterable to create a complex scope for the batch job. You can also use the iterable to create your own custom process for iterating through the list.
If your code accesses external objects and is used in batch Apex, use Iterable<sObject> instead of Database.QueryLocator.
GL
- Up to five queued or active batch jobs are allowed for Apex.
- A user can have up to 50 query cursors open at a time.
- A maximum of 50 million records can be returned in the Database.QueryLocator object.
- The maximum value for the optional scope parameter is 2,000.
- Default value of scope parameter is 200.
- The start, execute, and finish methods can implement up to 10 callouts each.
- The maximum number of batch executions is 2,50,000 per 24 hours
Apex Scheduler
- Schedules a class to execute at specified time.
- Implement the Schedulable interface for the class.
- Salesforce only adds the process to the queue at the scheduled time.
- Actual execution may be delayed based on service availability.
- You can only have 25 classes scheduled at one time.
Check the Schedule Queue at Setup >> Monitoring >> Scheduled Jobs.
Example: Schedule a Batch Class
global class scheduledBatchable implements Schedulable{
global void execute(SchedulableContext sc) {
Batchable b = new batchable ();
database.executebatch(b);
Using System.Schedule method
--> After you implement a class with the Schedulable interface, use the System.Schedule method to execute it.
--> System.Schedule method takes three arguments:
Example
ScheduledMerge m = new scheduledMerge ();
String sch = '20 30 8 10 2 ?';
system.Schedule('Merge Job', sch, m);
Example When
AW computing wants to develop a utility to clean junk/incomplete contact records on daily basis.
àDevelop a batch class to delete contact records having email as blank.
--> Schedule the Apex Batch Job written to execute every day at 1 AM.
Data Model:
Sales Objects—includes accounts, contacts, opportunities, leads, campaigns, and other related objects
Task and Event Objects—includes tasks and events and their related objects
Support Objects—includes cases and solutions and their related objects
User, Sharing, and Permission Objects—includes users, profiles, and roles
Profile and Permission Objects—includes users, profiles, permission sets, and related permission objects
Record Type Objects—includes record types and business processes and their related objects
Process Objects—includes approval processes and related objects
What is the difference between SAP CRM vs Salesforce CRM?
You can expect:
High reliability of the servers, 99.9% uptime (as with most other CRM vendors)
High standards of safety for your data, encrypted SSL connection (as with all other CRM vendors)
Long time to adapt the software to your needs
Having a dedicated person to maintain the software for your employees
OWD settings are the base level access to restrict user access to records created by others. Along with the object level settings defined within the Profile they decide whether the user will be able to - see only self created or other's records
View State
In simple words, it is a state to view which you are view and salesforce use it to regenerate your page, whenever there reply come back from server
For example, when you create a VF page having a some input fields, no consider that you load this page with some value and there are some required field on this page and when you click on a button, this page will get submitted to server then when server replay back your page should be loaded in same state as it was before submit button click, to maintain this salesforce exchange data between VF and severs and this information which salesforce maintain is known as View state
- Other than transient, you can user VF remoting and @ remote action, as it won’t transfer View state
- Also you can user mode=read-only, it a property of <page> tag
- Minimize number of form on a page.
- Use apex:actionRegion instead of using 2 or more forms.
- Refine your SOQL to only retrieve the data needed by the page.
- Don’t use page message attribute in vf pages.
- Decrease collection items if they are not going to be used in page.
Define private if they are not used on visualforce page.
The view state size of your Visualforce pages must be under 135 KB
http://howtodoitinsalesforce.blogspot.in/2016/12/an-introduction-to-visualforce-view.html
Good examples:
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State
Apex triggers
Apex triggers | Crimes in Trigger |
Bulk handling should be done for all triggers Complex business logic should be built in classes and should be called in Triggers. All triggers are bulk triggers by default, and can process multiple records at a time. Note: An Event object that is defined as recurring is not processed in bulk for insert, delete, or update triggers. Bulk triggers can handle both single record updates and bulk operations like: · Data import · Force.com Bulk API calls · Mass actions, such as record owner changes and deletes · Recursive Apex methods and triggers that invoke bulk DML statements · The code block of a trigger cannot contain the static keyword
Order of Execution When you save a record with an insert, update, or upsert statement, Salesforce performs the following events in order: 1 .Loads the original record from the database. 2. Loads the new record field values from the request and overwrites the old values.--> UI Validations 3.Before Triggers 4.Runs validations again 5. Saves to Database – Does not Commit. 6.After Triggers 7.Assignment Rules 8.Auto Response Rules 9.Workflow Rules 10.Workflow Field Updates -->Fire Before and After Triggers 11.Escalation Rules 12.Criteria Based Sharing 13.Commit DML to Database 14.Post Commit Logic – Send email etc Trigger used when --> Create a Task upon successful creation of a new Lead record. --> Create a new Trigger that will check for duplicates before allowing a new record into the database, for this sample we are checking email address. --> Create a field on Account for Total Contacts. Write a trigger on Contact to update Account with Total Contacts associated. I want to write trigger to enable a checkbox in contact whenever its Account is modified (updated). | àSOQL/SOSL/DML in a loop body àSend Email/Scheduling classes/Executing batch process/Schema Describe calls in a loop body, Hardcoding Trigger.new/old Operations that don’t Invoke Triggers àCascading delete/updates operations àMass campaign status changes/division transfers/division transfers/address updates/approval request transfers/email actions àModifying custom field data types àRenaming or replacing picklists Context Variable àAll triggers define implicit variables that allow developers to access runtime context. These variables are contained in System.Trigger class. Trigger Exceptions à Triggers can be used to prevent DML operations from occurring by calling the addError() method on a record or field. Trigger.new : Returns a list of the sObject records which we are going to insert into database Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers Trigger.old: Returns a list of the sObject records which already there in database Note that this sObject list is only available in update and delete triggers
Sales Cloud : refers to the "sales" module in salesforce.com It includes Leads, Accounts, Contacts, Contracts, Opportunities, Products, Price books, Quotes, and Campaigns (limits apply). It includes features such as Web-to-lead to support online lead capture, with auto-response rules
Service Cloud : refers to the "service" (as in "customer service") module in salesforce.com It includes Accounts, Contacts, Cases, and Solutions. It also encompasses features such as the Public Knowledge Base, Web-to-case, Call Center, and the Self-Service Portal, as well as customer service automation (e.g. escalation rules, assignment rules).
1.What is Profile? ANS: Profile contains set of permissions and access settings that controls what user can do with in the organization.
5.What is User? ANS:The people who have authenticated username and password to login to the salesforce successfully.
6.What is Sharing Rules? ANS: These are used to override the OWD permissions. Sharing rules are two types 1.Based on record owner 2.Based on criteria. What is the importance of ‘Sharing Rules’? A: By using these rules we can provide accessibility from one group to another group & one role to another role. So users of one group can access the information of another group like that we can share the roles in between the users. What is the recursive trigger? Ans: Recursion occurs in trigger if your trigger has a same DML statement and the same DML condition is used in trigger firing condition on the same object(on which trigger has been written)
How do we avoid recursive triggers? Ans: Use a static variable in an Apex class to avoid an infinite loop. Static variables are local to the context of a Web request.
|
Managed packages | Unmanaged packages |
In managed package certain components are locked and changes are not allowed. | Editable by developer and Installer cannot be upgraded.
|
Only developer edition can create managed package | All editions can create unmanaged package |
managed package used for 1: Many distributions | Unmanaged package used for 1:1 distributions |
Managed packages are also fully upgradeable | Unmanaged packages are can’t fully upgradeable |
Benefits: Intellectual property protection for Apex Built-in versioning support for API accessible components The ability to branch and patch a previous version The ability to seamlessly push patch updates to subscribers Unique naming of all components to ensure conflict-free installs |
|
Managed packages are typically used by Salesforce partners to distribute and sell applications to customers | Unmanaged packages are typically used to distribute open-source projects |
Unmanaged packages should not be used to migrate components from a sandbox to production organization. Instead, use Change Sets. |
|
Jobs:
// loop through jobs located by name that we need to abort
for(CronTrigger ct : [SELECT Id, CronJobDetail.Name, CronJobDetail.JobType FROM CronTrigger WHERE CronJobDetail.Name like 'Work Order%']){
// abort the job, try/catch because the job might not exist
try{ system.abortJob(ct.id);
} catch (exception e) {}}
===
List<CronTrigger> job = [Select CronJobDetailId,StartTime From CronTrigger ];
system.abort(job[0].Id);
// System.abortJob(sc.getTriggerID());
Custom Settings Limits and Considerations
You can add up to 300 fields per custom settings
If your org has 20 full licenses, you have 10 MB of storage.
How to access this List type custom setting in Apex:
M1:// Returns a map of the data sets defined for the custom setting.
Map<String, Status_Code__c> mapStatusCodeCustomSetting = Status_Code__c.getAll();
for(Status_Code__c mandatoryRoles : mapStatusCodeCustomSetting.values()){}
M2:for(Status_Code__c mandatoryRoles : Status_Code__c.getAll().values()){}
M3 :Status_Code__c statusCodeCS = Status_Code__c.getValues('400');
String statusCode = statusCodeCS.Code__c;
M4: String statusCode = Status_Code__c.getValues('400').Code__c;
Hierachy:
A type of custom setting that uses a built-in hierarchical logic that checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value.
M1:// Returns a custom setting data set record for the current user.
Authentication_Token_Setting__c authTokenSetting = Authentication_Token_Setting__c.getInstance();
M2:// Returns the custom setting data set record for the specified User ID or Profile ID.
Authentication_Token_Setting__c authTokenSetting = Authentication_Token_Setting__c.getInstance(Userinfo.getUserId());
M3:// Returns the custom setting data set record for the organization.
Authentication_Token_Setting__c authTokenSetting = Authentication_Token_Setting__c.getOrgDefaults();
M4:// Returns the custom setting data set record for the specified User ID or Profile ID.
Authentication_Token_Setting__c authTokenSetting = Authentication_Token_Setting__c.getValues(Userinfo.getUserId());
VF Best Practices
In all cases, Visualforce pages must be under 15 MB.
- View State Size
- 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
- Consider refining your SOQL calls to return only data that's relevant to the Visualforce page.
- If your view state is affected by a large component tree, try reducing the number of components your page depends on.
- User transient , use mode= readonly, user actionRegion
- Load Times
- 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
- “Lazy load” Apex objects to reduce request times
- Multiple Concurrent Requests
- Action methods used by <apex:actionPoller> should be lightweight
- It’s a best practice to avoid performing DML, external service calls
- Move non-essential logic to an asynchronous code block using Ajax.
- Queries and Security
- By using 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.
Apex Code Best Practices
Few more Best Practices for Triggers
- There should only be one trigger for each object.
- Avoid complex logic in triggers. To simplify testing and reuse, triggers should delegate to Apex classes which contain the actual execution logic.
- Bulkify any "helper" classes and/or methods.
- Trigers should be "bulkified" and be able to process up to 200 records for each call.
- Execute DML statements using collections instead of individual records per DML statement.
- Use Collections in SOQL "WHERE" clauses to retrieve all records back in single query
- Using Collections, Streamlining Queries, and Efficient For Loops
- Streamlining Multiple Triggers on the Same Object
- Querying Large Data Sets
- Use of the Limits Apex Methods to Avoid Hitting Governor Limits
- Writing Test Methods to Verify Large Datasets
- Use a consistent naming convention including the object name (e.g., AccountTrigger)
https://developer.salesforce.com/page/Apex_Code_Best_Practices
Test class best practices:
- All test methods should reside in a separate class from the class in which the method being tested resides.
- Ex: use test followed by classNme, use @isTest annotation.
- There should be a minimum of “Null Pointer Exception test” as part of negative testing for each method, especially for the methods that accept parameters.
- Use assert statement that will give more confidence in the correct behavior of business logic.
- Put a comment with each assert statement explaining what is being tested and what the expected output is
- Only use isTest(SeeAllData = true) on class methods in exceptional cases where there are sObjects that don't allow DML operation e.g. PriceBook creation
- No hard coded ids of any sObject in any test method.
- All test data creation should be done from a Utility class. This allows for a streamlined creation of test objects that follow to all the validation rules.
- Any business logic that needs to be tested should be enveloped within a runAs(user) statement so profile restrictions can be tested. Using any admin profiles should be avoided.
- All private methods should also have its corresponding unit test method. In the production code, add a public method for each private method and prepend it by “exposeForUnitTest_”.
- Any asynchronous method testing should include Test.startTest and Test.stopTest. Test.stopTest forces the asynchronous methods to run so the results could be asserted.
- Any exceptions that are caught in the production methods should be tested by feeding the test data that throws exception. Exception Type and the error message should be asserted.
Dashboards
Dynamic dashboard | dashboard |
Dynamic dashboards are used to display information custom-made to a specific user, Use dynamic dashboards when you want to show each user, user-specific data, such as their personal quotas and sales, or number of case closures, or leads converted, etc. · You can't save dynamic dashboards to personal folders. · You can't schedule refreshes for dynamic dashboards. They must be refreshed manually.
| While a normal dashboard shows data only from a single user's perspective. Use a normal dashboard when you want to show regional or organization-wide data to a set of users, such as a region's sales, or a support team's performance on case closures |
Change set conditions
- If you create or modify components unavailable in a change set, you can’t send those components from one org to another in a change set. In this case, migrate the changes manually by repeating the steps you performed when you created or modified the component.
- By default, list views are visible to all users when you deploy a change set. You can deploy a change set with Restricted Visibility, or change the visibility in the destination org if necessary.
- Deployed custom tabs are hidden by default for all users. They’re visible only if the change set also contains profiles that set the visibility property appropriately. Professional Edition orgs are an exception—deployed custom tabs in those orgs are always visible by default.
- Reports stored in the My Personal Custom Reports folder (private reports) don’t appear in the list of reports that can be added to the change set. Reports stored in the Unfiled Public Reports folder appear in the list of reports that can be added to the change set, but they aren’t deployed even if added to the change set. To deploy a private or unfiled report using a change set, first copy or move the report to a different report folder.
- Restrictions for Approval Processes in Change Sets
- To prevent a deployment from failing when components are referenced by Apex jobs, in the Deployment Settings page, click Allow deployments of components when corresponding Apex jobs are pending or in progress, and then click Save.
Multi-tenancy:
Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers. Each customer is called a tenant. Tenants may be given the ability to customize some parts of the application, such as color of the user interface (UI) or business rules, but they cannot customize the application's code.
Batch calls in another batch:
- To call another batch class from a batch class,
- Call another batch class in the finish method.
- As execute method being called many times but Start and finish method only once.
- So once your main batch is completed and the finish method is called and then it will call the another batch
Call DML in constructor:
- Salesforce has blocked this due to security issues.
- DML operation is not allowed in the constructor of Apex class.
- Whenever we go for a DML operation in constructor it restricts us in Salesforce. Only DDL is allowed.
- So we may use some other route.
Use JavaScript to invoke an action method on the controller, and have this action method carry out the DML operation. In order to ensure that this doesn’t happen every time that the page is refreshed, use “myFlag” boolean in controller that is set to false in the constructor, and updated to true once the DML has taken place.
If you call DML operations in VF, will get an error as System.LimitException: DML currently not allowed
Ex: class and page: constructorObjInsert
Class: ConstTest if you call constructor from anonymous block it will execute but it will not execute when invoking from VF page
Sample code: https://github.com/jeffdonthemic/Blog-Sample-Code/tree/master/salesforce/src
Salesforce Console
A Salesforce Console app is a tab-based workspace that lets you manage multiple records on a single screen. The console inherently minimizes clicking and scrolling so that you can quickly find, update, and create records. Thousands of customers rely on the Salesforce Console to boost productivity in fast-paced service and sales environments.
Community App: Account, contacts, Chatter, Ideas, reports, dashboards
Marketing Cloud: Chatter, campaigns, leads, contacts, opportunities, reports, dashboards
Salesforce Chatter: Chatter, profile, people, groups, files
Product, Pricebook relationship
Products are the individual items or services that you sell to customers through your opportunities and quotes.
Price Books are list of products and their associated prices. Each product and its price is called a price book entry. So, if you want to speak in relationship terms, a Product may be on multiple Pricebooks; this is managed with a junction record called PricebookEntry.
Here is the relationship between Opportunity, OpportulityLineItem , PricebookEntry, Pricebook and Product2 .
- OpportunitylineItem is junction object between opportunity and pricebookentry.
As We need PricebookEntry Id and opportunity Id while creating OpportunityLineItems.
- PricebookEntry is a junction object between Product2 and PriceBook.
As we need Product2 Id and PriceBook2 Id while creating PricebookEntries.
Whenever we add products on any opportunity, behind the curtain this data model works.
Chatter
- Chatter is a corporate network that lets your users work together, talk to each other, and share information, all in real time.
- Chatter is an enterprise collaboration platform from Salesforce, (CRM) vendor.
- Chatter can be used as a company intranet or employee directory.
- Each employee has a profile page with photo and work-related information that explains
- what the employee’s role is within the company,
- who the employee reports to,
- Where the employee is located and how to contact the employee.
- Employees can “follow” both people and documents to collaborate on sales opportunities, service cases, campaigns, projects and tasks.
- Like Facebook and LinkedIn, Chatter allows users to manage their feeds and control how notifications are received.
Query Currency Fields in Multicurrency Organizations:
If an organization is multicurrency enabled in “company information” page, you can use convertCurrency() in the SELECT clause to convert currency fields to the user's currency. An organization has enabled advanced currency management, dated exchange rates will be used when converting currency fields on opportunities, opportunity line items, and opportunity history.
Syntax: convertCurrency(field)
Example: SELECT Id, convertCurrency(AnnualRevenue) FROM Account
You cannot use the convertCurrency() function in a WHERE clause. Use as below below syntax
WHERE Object_name Operator ISO_CODEvalue (SELECT Id, Name FROM Opportunity WHERE Amount > USD5000)
Validation rule on making a field required for a certain profile
AND( $Profile.Name = "Sales Member", ISBLANK(mandry__c)) | AND( $User.Alias = "System2", ISBLANK(mandry__c) ) |
Customer and portal user
Partner Portal | Customer Portal |
Partner Portal exposes the Leads and Opportunity objects whereas the Customer Portal does not. Partner Portal is to support your Partners Partner users are Salesforce users with limited capabilities They are associated with a particular partner account, have limited access to your organization’s data, and log in via a partner portal. But when compared, Partner portal is costlier than Customer Portal.
| Customer Portal is to support for your customers Customers who have Portal Licenses can either swap for Community Licenses, or use their existing licenses to use Communities. Also customers who already have Portal can continue to use them |
Communities:
- Communities launched in Summer'13.
- Communities combine the power of the Force.com platform, Site.com branding, lightning components, and Chatter collaboration.
- Use communities, to connect with customers in a personalized way, expose CRM and support functionality in a shared space, and share them with the internal and external users.
- Communities contain the functionality available in partner portals and customer portals, plus many more features
- Before : Partner and Customer Portals àNow : Communities with Partner and Customer Licenses
- Before : Limited customization àNow : Pixel perfect customization, including customization of login pages. Use of Site.Com as well as VF Pages for Customization. Also some ability to customize email with branding.
- Before : No Chatter àNow : Chatter with controls to limit people to groups, limit posts to just internal audience and / or external.
- Internal Users can switch between communities, similarly to how we can switch between applications. Communities also support SSO.
New things:
The power of Chatter within communities for partner and customer users, including:
– Public and private groups– File sharing– Topics and recommendations– Social profiles– Chatter REST API– Private tasks for partner and customer community users
Management of community members using profiles and permission sets
Access to reports and dashboards for partner users
How to retrieve deleted records in test class: @IsTest(SeeAllData=true)
Hot access private methods in test class: @testVisable
SF releases per year
Spring = Feb, Summer=June ( patch 11.2), Winter=Oct
Service types: Performance Degradation Service Disruption Maintenance
- The new release will immediately impact your SF organization as the entire instance is upgraded.
- Some features are turned on by default while others require an administrator to activate (and sometimes a new license add-on).
- The release notes give full detail of all new features and how they are activated.
Case Limits
- You can capture up to 5,000cases in a 24–hour period.
- If your company generates more case requests than that, click Help at the top of any page and select the My Cases tab to submit a request for a higher limit directly to Salesforce Customer Support.
- When your organization reaches the 24–hour limit, Salesforce stores additional requests in a pending request queue that contains both Web-to-Case and Web-to-Lead requests.
- The requests are submitted when the limit refreshes.
- The pending request queue has a limit of 50,000 combined requests.
- If your organization reaches the pending request limit, additional requests are rejected and not queued.
- Your administrator receives email notifications for the first five rejected submissions.
- Contact Salesforce Customer Support to change your organization's pending request limit.
Database.Stateful:
- If you specify Database.Stateful in the class definition, you can maintain state across these transactions.
- When using Database.Stateful, only instance member variables retain their values between transactions.
- Static member variables don’t retain their values and are reset between transactions. Maintaining state is useful for counting or summarizing records as they’re processed.
- For example, suppose your job processed opportunity records. You could define a method in execute to aggregate totals of the opportunity amounts as they were processed.
- If you don’t specify Database.Stateful, all static and instance member variables are set back to their original values.
MIXED_DML_OPERATION
- Some sObjects require that you perform DML operations on only one type per transaction.
- You cannot insert an account, then insert a user or a group member in a single transaction.
- You can definitely do DMLs on the Setup Objects but not in the same transaction where you're performing DMLs on Setup and Non-Setup Objects simultaneously.
- sObjects That Don’t Support DML Operations
Avoid mixed DML operations exception
You can perform DML operations on more than one type of sObject in a single class using the following process:
- Create a method that performs a DML operation on one type of sObject.
- Create a second method that uses the future annotation to manipulate a second sObject type.
- Separate the execution context in the test class using Test.startTest() and Test.stopTest().
- Use @future to Bypass the Mixed DML Error in a Test Method
- See if you can use System.runAs() to separate the DML operation
- User usr = [Select id from User where Id = :UserInfo.getUserId()];
RunAs(usr)
{ Test.startTest();
insertTestTerritory();
Test.stopTest(); }
- User usr = [Select id from User where Id = :UserInfo.getUserId()];
- Use @future annotated method. This would run the code in a different transaction.
- Includes spawning Batch Apex all of which has an advantage of = "they run in a different transaction" unit.
- Put them in a different transaction
Setup objects (group, group member, user, user role) are objects that are used to interact with the metadata.
Every other objects like those which are native (Standard Objects) and Custom Objects fall into the category of Non-Setup Objects.
Design Patterns
https://developer.salesforce.com/page/Apex_Design_Patterns
Singleton : The Singleton pattern attempts to solve the issue of repeatedly using an object instance
Problem : Developers often write inefficient code that can cause repeated instantiation of objects.
This can result in inefficient, poorly performing code, and potentially the breaching of governor limits.
This most commonly occurs in triggers, as they can operate against a set of records
Solution:
- Creating a class with a method that creates a new instance of the class if it doesn't already exist
- If it already exists, then simply return a reference to that object
private static AccountFooRecordType instance = null; //lazy-initialization
private static final AccountFooRecordType instance = new AccountFooRecordType(); //eager-initialization
private AccountFooRecordType(){ }
public static AccountFooRecordType getInstance(){ …..}
Strategy: The Strategy pattern (aka the policy pattern) attempts to solve the issue where you need to provide multiple solutions for the same problem so that one can be selected at runtime.
Problem: You need to provide a geographical-based search engine solution where the implementing code can choose the search provider at runtime.
Conclusion: The Strategy design pattern uses aggregation instead of inheritance, allowing better decoupling between the behavior and the class that uses the behavior. This allows the behavior to be changed without breaking the classes that use it, and the classes can switch between behaviors by changing the specific implementation used without requiring any significant code changes.
Decorator: The Decorator pattern attempts to solve the issue where you need temporary fields for processing (typically in Visualforce) but do not need to add these fields to the sObject.
Common uses for this pattern include:
- Selection Checkbox – a list of records that the user selects and applies behavior to; the selection checkbox is not saved
- Calculated fields – a complex read-only value that cannot be easily done in a formula field (e.g. calculation of a check digit)
- Proxy fields – a field, that when updated, converts to a different value on the record (e.g. temperature figures presented to the user in C, but stored as F)
This pattern is primarily for Visualforce use cases.
Problem: You need to obtain or display temporary information on a Visualforce page that is not needed beyond the context of the interaction.
Façade : The primary purpose of the Facade pattern is to provide a simpler interface to a complex class. This avoids repeated code and increases maintainability. Common uses include:
Simplifying the execution of an Apex Web Service Proxy class
Simplifying the execution of custom Apex classes with complex interfaces
Providing a single interface to execute methods in multiple classes (e.g. multiple web service callouts)
Composite: The Composite Design Pattern allows for representation of expressions, such as;
1 AND 2
1 OR (2 AND 3)
(1 AND 2) OR ((3 OR 4) AND 5)
Bulk State Transition
The Bulk State Transition design pattern is a general pattern used for performing bulk actions in Apex based on the change of state of one or more records.
Description of GL | Synchronous Limit | Asynchronous Limit |
Total number of SOQL queries issued1 (This limit doesn’t apply to custom metadata types. In a single Apex transaction, custom metadata records can have unlimited SOQL queries.) | 100 | 200 |
Total number of records retrieved by SOQL queries | 50,000 | |
Total number of records retrieved by Database.getQueryLocator | 10,000 | |
Total number of SOSL queries issued | 20 | |
Total number of records retrieved by a single SOSL query | 2,000 | |
Total number of DML statements issued2 | 150 | |
Total number of records processed as a result of DML statements, Approval.process, or database.emptyRecycleBin | 10,000 | |
Total stack depth for any Apex invocation that recursively fires triggers due to insert, update, or delete statements3 | 16 | |
Total number of callouts (HTTP requests or Web services calls) in a transaction | 100 | |
Maximum timeout for all callouts (HTTP requests or Web services calls) in a transaction | 120 seconds | |
Maximum number of methods with the future annotation allowed per Apex invocation | 50 | |
Maximum number of Apex jobs added to the queue with System.enqueueJob | 50 | |
Total number of sendEmail methods allowed | 10 | |
Total heap size4 | 6 MB | 12 MB |
Maximum CPU time on the Salesforce servers5 | 10,000 milliseconds | 60,000 milliseconds |
Maximum execution time for each Apex transaction | 10 minutes | |
Maximum number of push notification method calls allowed per Apex transaction | 10 | |
Maximum number of push notifications that can be sent in each push notification method call | 2,000 | |
The maximum email attachment size | 3 MB | |
For a file attached to a Solution, the limit is | 1.5MB. | |
Salesforce.com restricts an attachment size to a maximum size of | 5 MB |
You can contact Salesforce.com support and possibly have them increase these limits. They should be able to increase the document and attachment size to 25MB. They cannot increase the limits for emails.
Useful info:
Workflow examples
- Update LastPatientName on Doctor whenever patient created and updated(CàP)
Patientà doctor : LastPatientà select name( patient>Patient name)
Append the last patient name in doctor object when patient name is created as
Formula Value: doctors__r.LastPatient__c +” , “+ Name
Rule Criteria: patient: Created DateEQUALSTODAY
Workflow action: TriggerMail: select Mail template, add recipientsàsave
Process Builder examples:
- Update pickup list in Account whenever account created and updated(CàP)
Contactà[Contact].Account ID: Account TypeàpickuplistàCustomer Channel
- Update LastPatientName on Account whenever patient created and updated(CàP)
Patientà [patient__c].doctor : LastPatientàformulaà[patient__c].Name
- Update Doctor Fax number in Patient recordàDocFaxNoupdate (PàC)
Doctorà [doctor__c].patients__r : DocFaxNoupdateà formulaà[Doctor__c]. DocFaxNoupdate
Rollup summary:
- Update total number of contact in Account(CàP)
Create new field NoOfContact on Account type Rollup summary select count();
This can be possible in triggers also.
Formula field:
- Add/update same accountnumber in opportunity from Account when account is updated (PàC)
Create new field accountnumber in Opportunity type formula and select Account.AccountNumber (opportunity>account> AccountNumber)
Approval Process:
- Create template: approval template from email template and place in Unfiled public email templated
- Approval processà Create new Approval process(user standard setup wizard from drop down): ApproveReqIfDfeeGT500
- Put condition: Dfee >500 and select either one option below
- Administrators ONLY can edit records during the approval process
- Administrators OR the currently assigned approver can edit records during the approval process.
- Select email template: ApproveEmailTemp
- Select some fields to display : doctor name , owner, Dfee
- Select one options below
- Allow approvers to access the approval page from within the Salesforce application, or externally from a wireless-enabled mobile device
- Allow approvers to access the approval page only from within the Salesforce application. (Recommended)
- Select allowed submitter: doctor owner, record creator
- Select submissions setting : Allow submitters to recall approval requests and save
Select Action to submit the record for Approve/reject ( select user)
- Create name: ToSFPUser
- Specify Step Criteria : select one below
- All records should enter this step
- Enter this step if the following
- Select Approver and save
Let the submitter choose the approver manually.
Automatically assign to queue.
Automatically assign to approver(s).
Select user to submit (SFPuser)
When multiple approvers are selected:
Approve or reject based on the FIRST response.
Require UNANIMOUS approval from all selected approvers.
- Create doctor record with Dfee 800 and submit for Approve
- Log in with another user SFP user and got to Doctor record and approve/reject, record might be locked until you approve or reject.
Scenario1:
I have 2 users
- SPU1à Profile is Standard platform useràrole is COO
- SPU2à Profile is Standard platform useràrole is COO
For both user have an Account object permission?
Question: SPU1 have created account record name AccountSPU1 which can’t visible to SPU2 user
SPU2 have created account record name AccountSPU2 which can’t visible to SPU1 user
Answer: go to sharing setting
- Manage sharing settings for : Account
Default Sharing Settings
Organization-Wide Defaultsà EDIT
Account and Contract: Default Internal Access: Private (not visible to another user)
Public read only (read by another user)
Public read/write only (read/write by another user)
Attachments:
** If your organization uses the partner portal to give your partner user’s access to Salesforce, we don't recommend enabling this setting. Enabling this setting prevents your organization from customizing the appearance of your partner portal.
- HTML attachments are not permitted on solutions, regardless of whether this security setting is enabled. In addition, this setting does not affect attachments on email templates; HTML attachments on email templates are always permitted.
- After this setting is enabled, previously-uploaded HTML documents and attachments are unaffected. However, when users attempt to view an HTML attachment or document, their browser first prompts them to open the file in the browser, save it to their computer, or cancel the action.
Set download behavior for each file type:
- Download (recommended)
- Execute in Browser
- Hybrid
Log Inspector
For more details click here
Jenkins:
Jenkins is an application that monitors the executions of repeatable jobs.
Jenkins focuses on:
- Building/testing software projects continuously
- Monitoring executions of externally-run jobs
IMP:
- We can assign the same page layout to different record type.
- We can’t create feed tracking on read only fields
- You can select up to 20 fields to track per object via Chatter Feed tracking for object. That can increase upto 60 fields if you raises the case to SF team and approved
- Limits
- Auto-number, formula, and roll-up summary fields
- Encrypted and read-only system fields
- The Expected Revenue field on opportunities
- The Solution Title and Solution Details fields on solutions; these fields display only for translated solutions in organizations with multilingual solutions enabled
- Limits
- Assign case to different record type bases on case create like from web to case, email to case.
ANS:
Create record types from case à recordtypeà create record types like A and B
Do page page layout assignment
Record type A à sales pagelayout
Record type B -> Support page layout
Goto workflow and create rule like:
Rule Criteria | Case: Case OriginEQUALSEmail |
Evaluation Criteria | Evaluate the rule when a record is created |
Add workflow action:
Select recordtype à A
- If you submit the request for the approval process where having inactive user: will get the message as below:
Inactive User Error
The approval request was sent to an inactive user. Only active users can receive requests.
Click here to return to the previous page
Scenario:
User 1 : submitted approval request for record doc fee= 300, to User2
User1 and user 2 opened approval link and opened the page:
User1 rejected first and user 2 approved the request and click on approve: user 2 will get the message as below:
Data Not Available
The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.
Salesforce limitations with continues intergradations click here
Custom permission: https://developer.salesforce.com/docs/atlas.en-us.securityImplGuide.meta/securityImplGuide/custom_perms_overview.htm
Salesforce to java application: http://www.ajaydubedi.com/featured/salesforce-rest-integration-java-application/
Public Group Vs Queue
Essentially both public group and queues are collection of user. The main difference is in terms of their usage.
Public Group | Queue |
Public Groups are used primary for security. | Queues are used primary as Owners of records. |
Public group created can be used across any objects. | They’re available for cases, leads, orders, custom objects, service contracts, and knowledge article versions. |
Public group for sharing | Queue is used for Load-balancing |
If you want to share some information in your organization among some users, so we make public Group. Public Group is the group of some selected users, then we can share information or we assign some work to group. | In our daily life we can take example of Call Centre to understand Queues. There are many Customer Care Executive in a call center and many customers call at a time and one executive can talk to one customer at one time, so other customer’s calls are kept in queues. Same thing is there in salesforce like: Each user should assigned to at least one lead and same number of leads. That means user need to handle assigned lead individually and all users in organization should assigned with same number of leads, in this case we can define users in organization as Queue and assign them one by one and in same number using round robin lead assignment. |
Salesforce Platform APIs
The following pages provide more information on how to access and use Salesforce APIs:
- REST API- Access objects in your organization using REST.
- SOAP API- Integrate your organization’s data with other applications using SOAP.
- Tooling API- Build custom development tools for Force.com applications. Coming soon!
- Chatter REST API- Access Chatter feeds and social data such as users, groups, followers, and files using REST.
- Bulk API- Load or delete large numbers of records.
- Metadata API- Manage customizations in your org and build tools that manage the metadata model (not the data, itself).
- Streaming API- Provide a stream of data reflecting data changes in your organization.
- Apex REST API - Build your own REST API in Apex. This API exposes Apex classes as RESTful Web services.
- Apex SOAP API- Create custom SOAP Web services in Apex. This API exposes Apex classes as SOAP Web services.
- com API- Data.com provides 100% complete, high quality data, updated in real-time in the cloud, and with comprehensive coverage worldwide.
Examples:
Process Builder to Send an Email Alert when the Opportunity Stage is not changed within 7 days
Can I associate Cases to a Lead?
Create a custom lookup field on Cases to the Leads object.
Example 2: You could create a custom button on the Case object (your name>Setup>App Setup>Customize>Cases>Buttons and Links) with a URL pass through that essentially takes for info from fields you specify and will open a new Lead create page and populate the fields on the Lead with info from that Case.
Future Methods with Higher Limits (Pilot)
One of the following limits can be doubled or tripled for each future method.
- Heap size
- CPU timeout
- Number of SOQL queries
- Number of DML statements issued
- Number of records that were processed as a result of DML operations, Approval.process, or Database.emptyRecycleBin
For more details click here ex: @future(limits='2xHeap')
Transfer / share the case
- There is a profile level permission called "Transfer Cases" that would allow users of that profile to transfer cases to other users
- We can also share the case the case by creating the case sharing rules in sharing rules:
- Options: Based on record owner/ Based on criteria
- In the Share with line, specify the users who get access to the data: select a category from the first drop-down list and a set of users from the second drop-down list or lookup field.
- Select the sharing access setting for users.
- Access Setting Description for more details click here.
- Read Only Users can view, but not update, records.
- Read/Write Users can view and update records.
Salesforce integration:
Want to download this app? Get if from the AppExchange and contact the publisher for further details.
You can also refer to the below mentioned list of integration services:
Informatica Cloud ,Cast Iron ,SnapLogic ,Boomi ,JitterBit
Sesame Relational Junction
Also refer to other APIs to integrate Salesforce with other databases:
Salesforce Web Services API
Salesforce Bulk API
Salesforce Rest API
How do Insert Accounts from external system into Salesforce.
ETL Tools:
Jitterbit Data Loader for Salesforce A free, third-party data migration tool that lets administrators automate the import and export of data between flat files, databases, and salesforce.com.
Dataloader.io No download, free data loader for Salesforce. Leverage keyboard shortcuts for object lookups and data mapping. No security token required.
Informatica Cloud Data Loader Informatica Cloud Data Loader for Salesforce is a FREE data loading application that automates the import/export of Salesforce and Force.com data between databases and files.
WebSphere Cast Iron Data Loader WebSphere Cast Iron Data Loader is a FREE cloud based integration solution that allows Salesforce users to import/exchange data between Salesforce and other data sources.
Language setting:
Organization's default language settings
A system administrator can enable multiple languages for your Salesforce organization. This means users have the option to select their preferred language from the available list.
Salesforce offers three levels of language support, as follows:
- Fully supported languages
- End user languages
- Platform-only languages
To enable an end user language for your organization, follow these steps:
- Navigate to Setup | Administer | Company Profile | Language Settings.
- From the Language Preferences section, select the Enable End User Languages checkbox to enable it:
For more info click here
Change the default language to the specific users
For that Goto :
Click on Setup | Administration Setup | Company Profile | Company Information | Edit and change the Default Language, Default Locale, and Currency Locale. All new users will inherit these Language and Locale settings.
Click on Setup | Administration Setup | Translation Workbench for more info assign for specific peoples
Data masking:
Our organization holds lots of sensitive data, specifically in the Account/Contact objects email address. We also use multi sandboxes for development, and as a security step, would like to mask (de-sensitive) selected fields once we have refreshed our sandboxes from production. This refresh task would likely take place at regular intervals.
Our idea is to have the ability to define on field level a sensitive level that allows data to be masked when it's being copied to full or partial sdboxes.
Masking: Informatica offers out of the box masking rules, including techniques for emails, names, addresses, SSN, phone numbers, etc. And you can build your own technique, no coding required. Moreover, we support consistent masking: if you need to mask Salesforce and other up/downstream apps that are in the landscape, you can use Test Data Management to mask consistently between all these applications.
The only two solutions I can see at the moment are: click here to create Apex class
- Informatica Cloud data masking
- Dataloader
Classic Encryption for Custom Fields
Restrict other Salesforce users from seeing custom text fields you want to keep private. Only users with the permission “View Encrypted Data” (in Permission set) can see data in encrypted custom text fields.
Assign Permissions and Create a Tenant Secret
Doc Mosey goes through the steps to give you the “Customize Application” and “Manage Encryption Keys” permissions. More info
Platform Encryption cannot be enabled for standard fields when Portals are enabled.
Encrypted Custom Fields
You can encrypt the contents of fields that belong to one these custom field types, on either standard or custom objects.
Email, Phone, Text, Text Area, Text Area (Long), URL, Date, Date/Time,
**After a custom field is encrypted, you can’t change the field type. For custom phone and email fields, you also can’t change the field format.
Beginning with spring ’17, Shield Platform Encryption no longer masks encrypted data in the presentation layer. This may affect some users’ ability to work with encrypted data
IMP data
Edit objectà Object Classification
** When these settings are enabled, this object is classified as an Enterprise Application object.
**When these settings are disabled, this object is classified as a Light Application object. Learn more.
Allow Sharing
To enable or disable manual user record sharing:
You can control whether the Sharing button is displayed on user detail pages. This button enables a user to grant others access to the user’s own user record. You can hide or display this button for all users by following these steps.
- From Setup, enter Sharing Settings in the Quick Find box, then select Sharing Settings.
- Click Edit in the Organization-Wide Defaults area.
- Select the Manual User Record Sharing checkbox to display the Sharing button on user detail pages, which enables users to share their records with others. Or deselect the checkbox to hide the button, which prevents users from sharing their user records with others.
- Click Save.
- **Sharing button is enabled when record sharing is set to public read only or private for the object
Record sharing button is disabled when:
- Sharing is disabled if the sharing model is set to "Controlled by Parent", which happens when you create a master-detail relationship.
- If the default sharing for your custom object is public read/write sharing is disabled. Or set to read/write sharing
Types of Actions
There are several types of quick actions you can create using point-and-click tools in Salesforce.
- Create actions let users create records
- Send email actions are supported in Lightning Experience only
- For cases, add the case-specific Send Email action
- Log a call actions let users record the details of phone calls or other customer interactions
- Question actions enable users to ask and search for questions about the records that they’re working with
- Update actions let users make changes to a record.
Quick Actions
Actions enable users to do more in Salesforce and in Salesforce1. For example, you can let users create or update records and log calls directly in their Chatter feed or from their mobile device.
Object-Specific Quick Actions
- Object-specific actions let users quickly create or update records, log calls, send emails, and more, in the context of a particular object.
- For example, you add an object-specific action on the Account object that creates contacts.
- If a user creates a contact with that action on the detail page for the Acme account, that new contact is automatically associated with Acme. You can only add an object-specific action to page layouts for that object.
Global Quick Actions
- You can add global actions to almost any page that supports actions. Global create actions enable users to create object records, but the new record has no relationship with other records. For more info click here created new QAction create doctor & published
- ** we can’t create GAction for the child object( Patient) having M-D relationships( Doctor, dicease)
Data Loader - importing contacts & accounts
- Manually look up the Accounts and add the IDs to a new column in the Contacts file (bad idea unless you have 20 or less Contacts).
Export your Accounts table with the ID field and Account Name and export. Then manually match them from one file to another. (Ok up to maybe 50... 100 if you are feeling really adventurous).
3. Export your Accounts table with the ID, Account Name and then use a VLOOKUP() formula to find the Account ID for each Contact and populate it on the Contacts file. (Highly recommended) - VLOOKUP( value, table, index_number, [approximate_match] )
JavaScript Remoting
- JavaScript remoting is a tool that front-end developers can use to make an AJAX request from a Visualforce page directly to an Apex
- JavaScript remoting allows you to run asynchronous actions by decoupling the page from the controller and to perform tasks on the page without having to reload the entire page.
- Here are some specific differences between the two.
- The <apex:actionFunction> tag:
- lets you specify rerender targets
- submits the form
- doesn’t require you to write any JavaScript
- JavaScript remoting:
- lets you pass parameters
- provides a callback
- requires you to write some JavaScript
Visualforce Remote Objects:
- Makes basic “CRUD” object access easy
- Doesn’t require any Apex code
- Supports minimal server-side application logic
- Doesn’t provide automatic relationship traversals; you must look up related objects yourself
JavaScript Remoting:
- Requires both JavaScript and Apex code
- Supports complex server-side application logic
- Handles complex object relationships better
- Uses network connections (even) more efficiently
- Primary keys (Id, Name and Owner fields)
- Foreign keys (lookup or master-detail relationship fields)
- Audit dates (such as LastModifiedDate)
- Custom fields marked as External ID or Unique.
Fields that can't be indexed in SOQL are:
- Multi-select picklists
- Currency fields in a multicurrency organization
- Long text fields
- Some formula fields
- Binary fields (fields of type blob, file, or encrypted text.)