Friday, 11 November 2016

Comparing old and new values in a trigger





In the Below Example making check box to true if status field is changed to closed own 

// Check a checkbox only when an Opp is changed to Closed Won!
trigger Updatecheck on Opportunity (before update) {

  for (Opportunity opp : Trigger.new) {
    // Access the "old" record by its ID in Trigger.oldMap
    Opportunity oldOpp = Trigger.oldMap.get(opp.Id);

    // Trigger.new records are conveniently the "new" versions!
    Boolean oldOppIsWon = oldOpp.StageName.equals('Closed Won');
    Boolean newOppIsWon = opp.StageName.equals('Closed Won');
    
    // Check that the field was changed to the correct value
    if (!oldOppIsWon && newOppIsWon) {
      opp.I_am_Awesome__c = true;
    }
  }
}

Wednesday, 9 November 2016



Debug logs for Site Guest User


Please follow below steps

  1. Ask the user to set a browser cookie with a domain of .force.com, a name of debug_logs, and any value. Refer to the documentation for your user’s browser for information on adding cookies. To add cookies, your user probably needs a browser plug-in or extension for web development.
    • To set a cookie for API requests made with Java code, use the URLConnection class and set the cookie value as follows.
      URL url = new URL("http://yourSite.force.com/");
      URLConnection con = url.openConnection();
      con.setDoOutput(true);
      con.setRequestProperty("Cookie", "debug_logs=debug_logs,domain=.force.com");
      con.setRequestProperty("Content-Type", "text/plain; charset=utf-8");
      con.connect();
    • To set a browser cookie in Google Chrome™:
      1. Navigate to your site.
      2. Open the Chrome DevTools Console by pressing Ctrl+Shift+J (Cmd+Opt+J on macOS).
      3. Execute this command.
        document.cookie="debug_logs=debug_logs;domain=.force.com";
    • To set a browser cookie in other browsers, install a plug-in or extension.
  2. Find the name of your site’s guest user.
    1. From Setup, enter Sites in the Quick Find box, then select Sites.
    2. Select your site from the Site Label column.
    3. Select Public Access Settings | View Users.
  3. Set a user-based trace flag on the guest user.
    1. From Setup, enter Debug Logs in the Quick Find box, then click Debug Logs.
    2. Click New.
    3. Set the traced entity type to User.
    4. Open the lookup for the Traced Entity Name field, and then find and select your guest user.
    5. Assign a debug level to your trace flag.
    6. Click Save.

Friday, 19 August 2016






what is the difference between != null and != ' '

!= null checks if the value is equal to null 
!= ' '  will check for a blank

id field can be either hold a 15 or 18 digit id or can be null but not blank
for string use string.isblank() returns true if string is space ,empty or null






Is there a way to Print the Number of SOQL Queries in Debug During Runtime?


System.debug('Total Number of SOQL Queries allowed in this apex code context: ' +  Limits.getLimitQueries());



System.debug('Total Number of SOQL Queries fired in this apex code context: ' +  Limits.getQueries());

Monday, 25 July 2016




Difference Between Task and Event in Salesforce


Ans : 

Event :- An event is a calendar event scheduled for a specific day and time.

Examples of events are:
1)      Meetings
2)      Scheduled Conference Calls

Anything that involves communication with another person should be set as an event. 

Task :- 
A task is an activity not scheduled for an exact day and time. You can specify a due date for a task or there may not be a particular time or date that the tasks or activities need to be completed by.

Examples of tasks are:
- A list of phone calls you need to make.
-  An email that needs to be sent. 

Salesforce Interview Question and Answers on Apex Class



1. Difference between with sharing and without sharing in salesforce

Ans. By default, all Apex executes under the System user, ignoring all CRUD, field-level, and row-level security (that is always executes using the full permissions of the current user).

with sharing:

Enforcing the User’s Permissions, Sharing rules and field-level security should apply to the current user.

For example:

public with sharing class sharingClass {

         // Code here

}

without sharing:

Not enforced the User’s Permissions, Sharing rules and field-level security.

For example:

public without sharing class noSharing {

        // Code here

}

2. Access Modifiers  in salesforce 

Ans.
– private: This method/variable is accessible within the class it is defined.

– protected: This method/variable is also available to any inner classes or sub-classes. It can only be used by instance methods and member variables.

– public: This method/variable can be used by any Apex in this application namespace.

– global: this method/variable is accessible by all Apex everywhere.

• All methods/variable with the web-service keyword must be global.

– The default access modifier for methods and variables is private.

3. Exceptions Statements  in salesforce 

Ans.

Throw: signals that an error has occurred and provides an exception object.

• Try: identifies the block of code where the exception can occur.

• Catch: identifies the block of code that can handle a particular exception. There may be multiple catch blocks for each try block.

• Finally: optionally identifies a block of code that is guaranteed to execute after a try block.
Exception Example:

public class OtherException extends BaseException {}

Try{

     //Add code here

     throw new OtherException(‘Something went wrong here…’);

} Catch (OtherException oex) {

     //Caught a custom exception type here

} Catch (Exception ex){

     //Caught all other exceptions here

}

4. What is the difference between a standard controller and custom controller ?

     Ans: standard controller inherits all the standard object properties, standard button functionalities can be directly used. Custom controller defines custom functionalities, a standard controller can be extended to develop custom functionalities using keyword "extensions"

5. How to get current logged in users id in apex ?

Ans. Userinfo.getuserid()


6. How to fire dynamic query in SOQL?

Ans. Database.query('select name from account'); 


7. How can you lock records in apex?

Ans. Use For update in query to lock the record. For example: [select id,name from contact limit 10 For update];

8. How can you access custom label in apex ?

Ans. System.Label.LabelNamehere

9. What is search layout? 

Ans . When we click on lookup field the results which is shown is called search layout.

10. What is mini page layout ? 

Ans. For lookup fields on record detail page we see a link, whenever we put cursor on that link we see a popup window which displays few fields.

Wednesday, 20 July 2016

Topic Wise Salesforce Interview Question and Answers

Salesforce Interview Questions on REST API and SOAP API



1. What is SOAP and What is REST?

REST API

Representational State Transfer.
It is based on URI
It works with GET, POST, PUT, DELETE
Works Over with HTTP and HTTPS


SOAP API

Simple Object Access Protocol.
It is based on Standard XML format
It works with WSDL
Works Over with HTTP,HTTPS,SMPT,XMPP


2. Difference between REST API and SOAP API?
Ans: Varies on records that can be handled. Generally if we want to access less number of records we go for REST API.

3. What is WSDL?
A WSDL is an XML Document which contains a standardized description of how to communicate using webservice.

4. What are the different types of WSDL'S?
Ans:
Enterprise WSDL
Partner WSDL
Apex WSDL
Metadata WSDL
Tooling WSDL
Delegated Atuntection WSDL

5. Difference between Enterprise WSDL and Partner WSDL?
Ans:
Enterprise WSDL:
It is used for building client applications for a single salesforce organization.
Customers who use enterprise WSDL document must download and re-consume it when ever their organization makes a change to its custom objects or fields or when ever they want to use a different version of the API.
Partner WSDL:
It is used for building client applications for multiple organizations.
The partner WSDL documention only needs to be downloaded consumed once per version of the API.

6. How can you expose an apex class as a REST web service in salesforce?
Ans - An apex class can be exposed as REST web service by using keyword '@RestResource'

7. How to fetch data from another Salesforce instance using API?
Ans: Use the Force.com Web Services API or Bulk API to transfer data this is a great job for the Bulk API.

8. How to call the Apex method from a Custom Button?
Ans: An Apex callout enables you to tightly integrate your Apex with an external service by making a call to an external Web service or sending an HTTP request from Apex code and then receiving the response.
Apex provides integration with Web services that utilize SOAP and WSDL, or HTTP services (RESTful services).

9. What is the use of Chatter REST API?
The Chatter API (also called Chatter REST API) lets you access Chatter information via an optimized REST-based API accessible from any platform. Developers can now build social applications for mobile devices, or highly interactive websites, quickly and efficiently.

10. How to fetch data from another Salesforce instance using API?
Answer: Use the FORCE.COM WEB SERVICES API or BULK API to transfer data We this this is a great job for the Bulk API.

11. What are callouts and call ins?
Making a request to an external system from salesforce is a callout.

Getting requests from an external system is a call in.

12. How many callouts to external service can be made in a single apex transaction?
Ans - A total of 10 callouts are allowed in a single apex transaction.

13. What is the maximum allowed time limit while making a callout to an external service in apex?
Ans - maximum of 120 second time limit is enforced while making callout to external service

14. What is the default timeout period while calling webservice from Apex.
Ans: 10 sec.

15. Can we define a custom time out for each call out?
Ans :
A custom time can be defined for each callout.
the minimum time is 1 millisecond and the maximum is 120,000 milliseconds.

16. How to increase timeout while calling web service from Apex?
Ans :
docSample.DocSamplePort stub = new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in milliseconds

Salesforce Interview Questions on Workflows and Approval Process




1. What is workflow ?
Ans: Workflow works based on certain criteria,By using workflow we can automate the business process like Email alerts,tasks,filed updates

2. What are the different kinds of evaluation criteria (events)?
Ans: 1.created
2.created, and every time it’s edited
3.created, and any time it’s edited to subsequently meet criteria

3. In which object workflows are stored?
Ans: Workflow

4. What is the difference between Created and everytime edited to meet the criteria and Created and edited to subsequently meet the criteria?
Ans: If we select 'Created and everytime edited to meet the criteria' whenever we create a record or edit a record if the criteria of the workflow rule meets then it will trigger every time. If we select 'Created and edited to subsequently meet the criteria' -

While creating the record criteria meets so that workflow will fire and while editing the record again criteria meets workflow won't fire (meeting the criteria to meeting the criteria)
While creating the record criteria doesn't meet so workflow won't fire and while editing the record workflow criteria meets then workflow will fire (not meeting the criteria to meeting the criteria)
Conclusion: Previous state of record should be not meeting criteria and current state of record should be meeting the criteria then only in current state workflow will fire.

5.What are the types of rule criteria’s?
Ans: 1.Criteria meet (field - operator - value, if there are multiple criteria’s then in filter criteria we can give conditions like ( 1 or 2) and 3, field to field comparison is not possible, we can't fetch the previous state information of the field )
2.Formula evaluated (we can write formulas with this we can do field to field comparison and we can fetch previous state value of the record)

6. What is immediate workflow action?
Ans: The action which will be performed immediately after the record criteria meets.

7. What is time-dependent workflow action?
Ans: The action which will be performed in future based on the any of the date field. To create time-dependent workflow action we should create one time trigger. in time trigger we can give either days or hours with the maximum of 999 value and we can select either before or after.

8. For which event we can't create time-dependent workflow action?
Ans: Created and every time edited to meet the criteria.

9. What are the different kinds of workflow actions?
Ans: New field update (we can update a field of the same object or the fields of the parent objects which are at the master side in a master-detail relationship, only for master-detail parent objects we can update the field and for lookup, we can't update)
New email alert (we can send emails if the criteria meets)
New task (we can create new task)
New outbound Message (we can make a callout)

10. What are the types of email templates?
Ans:1.Text
2.HTML (with letter head)
3.Custom HTML (without letter head)
4.Visual Force

12. How can you monitor future actions of time based workflow?
Ans: setup --> administration set up --> monitoring --> time based workflow

13. There is a time-based workflow which will update one of the fields if the criteria meet. User submits the record with valid criteria, workflow triggered so that the field update is queued in the 'time based flow' queue which will fire after one day. If the user modifies the record which is submitted before the scheduled date, after modification, a record criterion is not meeting. Whether the field will be updated or not on the scheduled date?
Ans: It won't trigger in the schedule date because if we modify the record to not meeting criteria that queued field update will be removed from the 'time based flow' queue.

14. For the same scenario explained in the above question what happens when we deactivate or modify the criteria of the workflow to different criteria? Whether the field will be updated or not in scheduled date?
Ans: Yes, It will trigger in scheduled date.

15. Scenario: There are two workflow rules on the same object say namely wf1 and wf2. If wf1 fires then a field will be updated on the same object, if the field updated and due to this wf2 criteria meets then what will happen, wf2 will fire or not?
Ans: It won't fire. To fire wf2 we should enable 'Re-evaluate Workflow Rules' checkbox of the field update which is there in wf1.

16. What is a recursive workflow rule? How to avoid recursive workflow rules?
Ans:Whenever we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule, due to this field update other workflow rules on the same object will be fired if the entery criteria of those workflow rules satisfied.

In case, in other workflow rules also if we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update recursive workflow rules will come in some scenarios.

We can take two steps to avoid recursive workflow rules -

For the workflow Evaluation Criteria if you choose created, and any time it’s edited to subsequently meet criteria option, we can avoid recursive workflow rules.
If you don't enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule we can avoid.

17. What is Approval Process?
Ans: If the criteria of the record meets then by clicking on submit for Approval button user can submit the record for approval (Note: Approval history related list should be displayed on the record detail page)

18. Scenario: After activating the approval process, I want to add one more step. Is it possible?
Ans: It’s not possible, to add one more step deactivate the approval process and clone the deactivated approval process and add the new steps.

19.In which object all Approval process are stored?
Ans: Approval

20. For which criteria in workflow "time-dependent workflow action" cannot be created?
Ans: created, and every time it’s edited

Salesforce Interview questions on Sandbox environment



1.What is refreshing of the sandbox and how to do it?
In order to update the sandbox with the data in production.
Refresh is done and refreshing a sandbox deletes the previous copy and updates the sandbox with a copy of production.

To refresh a sandbox logon to salesforce.com
With production id and password
Go to setup>company name>administrative tools>data management >sandbox
Click the refresh link next to the sandbox

Note: make sure u have a copy of it before u refresh a sandbox

2.What is sandbox?
To make any changes for the exiting application we should copy all contents of the production into a sandbox and make all changes after that test thoroughly after that move those changes into production.
To create the sandbox, in production we can find one link called sandboxes. by clicking on that link we can create the sandbox by choosing the type of the sandbox.

3.What is the sandbox URL?
test.salesforce.com

4. What are the types of Sandboxes?

Salesforce Interview questions on Reports and Dashboard

1. What is Report?
To summarize the information of an object we use reports.

2. What are the types of Reports?
Tabular (Displays records just like a table)
Summary (we can summarize the information based on certain fields)
Matrix (we can summarize the information in a two-dimensional manner, both rows, and columns)
Join (we can summarize information in different blocks on the same object and the related objects)

3. How many blocks we can create for join reports?
5 blocks.

4. How many maximum groupings we can do for a summary, matrix, and join reports?
3 groupings

5. What is bucketing in reports?
Bucket field in Reports in Salesforce is used to group values to the name we specify.
It can group only the below data types fields
1. Picklist
2. Number
3. Text

6. How many records we can display on-page for a report?
We can display up to 2000 records on a page. If more records are there to display we cannot see those through the user interface. If you export the records to an excel sheet then you can export all records.

7. Can we mass delete reports using Apex (Anonymous Apex)?
Salesforce has not exposed any API for Reports. So the best way is :
Move all reports needs to delete in the new folder.
Inform everyone that reports will be deleted after some time maybe 30 days.
Import your reports folder in Eclipse including all reports to be deleted and then delete the reports folder in eclipse. It will delete all the reports at once.

8. Explain what a is dashboard?
The dashboard is the pictorial representation of the report, and we can add up to 20 reports in a single dashboard.

9. What are the different Dashboard Components?
Salesforce dashboard components are used to represent data. Salesforce dashboards have some visual representation components like graphs, charts, gauges, tables, metrics, and visualforce pages. We can use up to 20 components in a single dashboard.

10. Is it possible to schedule a dynamic dashboard in Salesforce?
No, it is not possible to schedule a dynamic dashboard in Salesforce.

11. Which type of report can be used for dashboard components?
Summary and matric report.

12. Explain the dynamic Dashboard?
Dynamic dashboards in Salesforce displays a set of metrics that we want across all levels of your organization.
Dynamic Dashboards in salesforce are Created to provide security settings for the dashboards in salesforce.com. We may have a requirement in an organization to “view all data” by every user in an organization according to their access we have to select Run as Logged-in User. There are two setting options in Dashboards.
They are
1.Run as specified User.
2.Run as Logged-in User.

Salesforce Interview Questions on Batch Apex

1. What are the SOQL limitations in apex?
Ans: Total number of records retrieved by SOQL queries-50,000

2. What are the transaction limitations in apex?
Ans: Each execution of a batch Apex job is considered a discrete transaction.
For example, a batch Apex job that contains 1,000 records and is executed without the optional scope parameter from Database.executeBatch is considered five transactions of 200 records each.
The Apex governor limits are reset for each transaction.
If the first transaction succeeds but the second fails, the database updates made in the first transaction are not rolled back.

3. What is the need of batch apex?
Ans: By using Batch apex classes we can process the records in batches in asynchronously.

4. What is Database.Batchable interface?
Ans: The class that implements this interface can be executed as a batch Apex job.

5. Define the methods in the batchable interface?
Ans:
Start:
global Database.Querylocator start (Database.BatchableContext bc){}
Execute:
global void execute(Database.BatchableContext bc,List <p>){}
Finish:
global void finish(Database.BatchableContext bc) {}

6. What is the purpose of the start method in batch apex?
Ans: It collects the records or objects to be passed to the interface method execute.

7. What is the Database.QueryLocator?
Ans: If we use a Database.QueryLocator,
the governor limit for the total number of records retrieved by SOQL queries is bypassed. (Default 50,000 It allow up to 50 million records).

8. What is the iterable<Sobject>?
Ans: If you use an iterable,
the governor limit for the total number of records retrieved by SOQL queries is still enforced.

9. What is the use of executing method?
Ans: Contains or calls the main execution logic for the batch job.

10. How many times execute method is called?
Ans: Execute method is called for each batch of records.

11. What is the scope of execute method?
Ans: The maximum value for the optional scope parameter is 2,000

12. Can we call callouts from batch apex?
Ans: Yes we can call.

13. Can we call another batch apex from batch apex?
Ans: Yes you can call a batch apex from another batch apex . Either in the start method or in the finish method you can call other batch

14. How many callouts we can call in batch apex?
Ans: Batch executions are limited to one callout per execution.

15. Batch is synchronous or asynchronous operations?
Ans: Asynchronous operations.

16. What is the maximum size of the batch and minimum size of the batch?
Ans: The default batch size is 200 records. min?
max?

17. What is the Database.BatchableContext?
Ans: BatchableContext Interface is Represents the parameter type of a batch job method and
contains the batch job ID. This interface is implemented internally by Apex.

18. How to track the details of the current running Batch using BatchableContext?
Ans: You can check the AsyncApexJob.Status using the JobId from the Database.BatchableContext.

19. How many batch jobs can be added to the queue?
Ans: Queued counts toward the limit of 5.

20. What is Database.State full interface?
Ans:To maintain variable value inside the Batch class, Database.Stateful is used.

21. What is Database.AllowCallouts?
Ans:
To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition. For example:
global class SearchAndReplace implements Database.Batchable<sObject>,
   Database.AllowsCallouts{
              //Business logic you want by implementing Batchable interface methods
}
Callouts include HTTP requests as well as methods defined with the webService keyword.

22. What is AsyncApexJob object?
Ans: AsyncApexJob is Represents an individual Apex sharing recalculation job.
Use this object to query Apex batch jobs in your organization.

23. When a BatchApexworker record is created?
Ans: For every 10,000 AsyncApexJob records, Apex creates one additional AsyncApexJob record of type BatchApexWorker for internal use. 

Salesforce Interview questions on Apex Triggers


1. What is a trigger?
Ans: Trigger is a piece of code that is executed before and after a record is Inserted/Updated/Deleted from the force.com database.

2. What are the different types of triggers in sfdc?
Ans: 1.Before Triggers-These triggers are fired before the data is saved into the database.
2.After Triggers-These triggers are fired after the data is saved into the database.

3. What are trigger context variables?
Ans:
Trigger.isInsert: Returns true if the trigger was fired due to insert operation.
Trigger.isUpdate: Returns true if the trigger was fired due to update operation.
Trigger.isDelete: Returns true if the trigger was fired due to deleting operation.
Trigger.isBefore: Returns true if the trigger was fired before the record is saved.
Trigger.isAfter: Returns true if the trigger was fired after the record is saved.
Trigger.New: Returns a list of a new version of sObject records.
Trigger.Old: Returns a list of old versions of sObject records.
Trigger.NewMap: Returns a map of new version of sObject records. (map is stored in the form of map)
Trigger.OldMap: Returns a map of old version of sObject records. (map is stored in the form of map)
Trigger.Size: Returns a integer (total number of records invoked due to trigger invocation for the both old and new)
Trigger.isExecuting: Returns true if the current apex code is a trigger.

4. What is the difference between Trigger.New and Trigger.NewMap?
Ans:
Trigger.New is Returns a list of new version of sObject records but Trigger.NewMap is Returns a map of new version of sObject records.

5. What is the difference between Trigger.New and Trigger.Old?
Ans:
Trigger.New is Returns a list of a new version of sObject records and Trigger.Old is Returns a list of old version of sObject records.

6. What is the difference between Trigger.New and Trigger.Old in update triggers?
Ans: Trigger.new: Returns a list of the new versions of the sObject records. 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 old versions of the sObject records. Note that this sObject list is only available in update and delete triggers.

trigger.old is not available during insert.

7. Can we call batch apex from the Trigger?
Ans: A batch apex can be called from a class as well as from trigger code.
In your Trigger code something like below:-
// BatchClass is the name of batch class
BatchClass bh = new BatchClass();
Database.executeBacth(bh);

8. What are the problems you have encountered when calling batch apex from the trigger?
Ans:  future method call that performs more processing on the same record(s). The issue is that this entire process becomes recursive in nature and you receive the error "System.AsyncException: Future method cannot be called from a future method.


9. Can we call the callouts from the trigger?
Ans: yes we can. It is the same as the usual class method calling from the trigger. The only difference being the method should always be asynchronous with @future

10. What are the problems you have encountered when calling apex the callouts in a trigger?
Ans: Too many Future calls".

11. What is the recursive trigger?
Ans: Recursion occurs in trigger if your trigger has the same DML statement and the same DML condition is used in trigger firing condition on the same object(on which trigger has been written)

12. What is the bulkifying triggers?
Ans: By default, every trigger is a bulk trigger which is used to process the multiple records at a time as a batch. For each batch of 200 records.

13. What is the use of future methods in triggers?
Ans: Using @Future annotation we can convert the Trigger into an Asynchronous Class and we can use a Callout method.

14. What is the order of executing the trigger apex?
Ans:
1. Executes all before triggers.
2. Validation rules.
3. Executes all after triggers.
4. Executes assignment rules.
5. Executes auto-response rules.
6. Executes workflow rules.
7. If there are workflow field updates, updates the record again.
8. If the record was updated with workflow field updates, fires before and after triggers one more time. Custom validation rules are not run again.
9. Executes escalation rules.
10. If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through the save procedure.
11. If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. The grand-parent record goes through the save procedure.
12. Executes Criteria Based Sharing evaluation.
13. Commits all DML operations to the database.
14. Executes post-commit logic. Ex: Sending email.

15. 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.

16. How many triggers we can define on an object?
Ans: We can write more than one trigger But it is not recommended. Best practice is One trigger On One object.

17. How many time workflow filed update will be called in triggers?
Ans: If the record was updated with workflow field updates, fires before and after triggers one more time (and only one more time).
Note The before and after triggers fire one more time only if something needs to be updated. If the fields have already been set to a value, the triggers are not fired again.

Salesforce Interview Questions on Profiles,Permission Set,Users,OWD,Roles and Sharing Rules



1.What is Profile?
ANS: Profile contains a set of permissions and access settings that control what users can do within the organization.

2. What are the permission sets?
ANS: A set of permissions is given to the users without changing the profile.

3.What is OWD?
ANS: OWD'S are baseline record-level security for objects in the organization.
It is used to restrict access to data.

4.What are Roles?
ANS: A role controls the level of visibility that users have to an organization's data.

5.What is the User?
ANS: The people who have an 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.

7.What is the role hierarchy?
ANS: Role Hierarchy states that a higher hierarchy person can see lower hierarchy person records.

8.Can you override profile permissions with permission sets(i have defined some permissions in the profile, I am trying to use permission sets for the same object, can I override permissions for a particular object in the permission sets over to the profile?
ANS: No. Permission Sets are used only to extend the Profile permissions. It never overrides.

9. I want to have read/write permission for User 1 and read-only for User 2, how can you achieve?
ANS: Create a Permission Set with read/write and assign it to User 1.

10. I have an OWD which is read-only, how all can access my data and I want to give read-write access for a particular record to them, how can I do that?
ANS: All users can just Read the record.
Create a Sharing Rule to give Read/Write access with "Based on the criteria" Sharing Rules.

11.What is the difference between role hierarchy and sharing rules? will both do the same permissions?
ANS: Role Hierarchy states that a higher hierarchy person can see lower hierarchy person records.
Sharing Rule is used to extending the Role Hierarchy.

12. Is it possible to delete the user in salesforce?
ANS: No, once we create a user in salesforce we cannot delete the user record. We can only deactivate the user record.

13.How to provide security for Meta-Data files (Schema)?
ANS: Using Profiles and Permission Sets.

13. How to give permissions to two fields for different users who belong to different profiles?
ANS: Permission set

14. How many users are there in your project salesforce instance?
ANS:1000 (It will depend upon the number of licenses taken by the client, it will be like up to 4000 like that based on the client)

15.What is Grant Access Using Hierarchies?
ANS: In OWD we have Private but your higher position persons should see that time we go for Grant Access Using Hierarchies.

16. How we can change the Grant access using role hierarchy for standard objects?
ANS: Not possible.

17.What is manual sharing?
ANS: Manual sharing is to share a record to a particular user manually.
Go to the detail page of the record and click on the manual sharing button and assign that record to other users with Read or Read/Write access.
Manual Sharing button enables only when OWD is private to that object.

18. The difference between Profile and Roles?
ANS: Profiles are used for Object-level access settings.
Roles are used for Record level access settings.

Wednesday, 13 July 2016

How to correctly reference Record Types in filter criteria when using the Lightning Process Builder



There are three ways to reference the Record Type in filter criteria when working in the Lightning Process Builder. Each reference field requires a different reference to the Record Type to evaluate correctly. 

1. Record Type ID: [Object].RecordTypeId 

This option must use the full 18 digit record type ID of the record type.

2. Record Type Name: [Object].RecordTypeName

This option needs to use the Display Name of the Record Type.

3. Record Type Developer Name: [Object].RecordType.DeveloperName

This option needs to use the API name of the record type found on the "Record Type Name" field on the record type details page.



Tuesday, 12 July 2016




How to change required symbol color in Visualforce Page ?


For getting the above requirement Copy paste the below code in your visualforce page

<apex:page standardController="Account"> 
    <style>
    .requiredBlock {
        background-color: green !important;
    }
    </style>
    <apex:form > 
        <apex:pageBlock > 
            <apex:pageBlockSection title="Account Information" collapsible="true"> 
                <apex:inputField value="{!account.name}" required="true"/> 
                <apex:inputField value="{!account.type}" required="true"/> 
                <apex:inputField value="{!account.Industry}" required="true"/> 
                <apex:inputField value="{!account.rating}" required="true"/> 
             </apex:pageBlockSection> 
              <apex:pageblockButtons >
                    <apex:commandButton value="Save" action="{!save}"/>
<apex:pageblockButtons> 
        </apex:pageBlock> 
    </apex:form> 
 </apex:page>

In above code you will find a CSS with class "requiredBlock" which you will find when you right click the visualforce page and click on Inspect Element like below.

In above image you will find a div tag with class as requiredBlock which is acting for displaying required symbol so you need to use this class in your customized CSS inorder to override perdefined color(RED).

Final Output:



Note : The !important rule is a way to make your CSS cascade but also have the rules you feel are most crucial always be applied. A rule that has the !important property will always be applied no matter where that rule appears in the CSS document.






Monday, 11 July 2016




Salesforce Interview Question and Answer Part - 1


1. What are different kinds of reports?

-> Tabular: Tabular reports are the simplest and fastest way to look at data. Similar to a spreadsheet, they consist simply of an ordered set of fields in columns, with each matching record listed in a row. Tabular reports are best for creating lists of records or a list with a single grand total. They can’t be used to create groups of data or charts, and can’t be used in dashboards unless rows are limited. Examples include contact mailing lists and activity reports.

-> Summary: Summary reports are similar to tabular reports, but also allow users to group rows of data, view subtotals, and create charts. They can be used as the source report for dashboard components. Use this type for a report to show subtotals based on the value of a particular field or when you want to create a hierarchical list, such as all opportunities for your team, subtotaled by Stage and Owner. Summary reports with no groupings show as tabular reports on the report run page.

-> Matrix: Matrix reports are similar to summary reports but allow you to group and summarize data by both rows and columns. They can be used as the source report for dashboard components. Use this type for comparing related totals, especially if you have large amounts of data to summarize and you need to compare values in several different fields, or you want to look at data by date and by product, person, or geography. Matrix reports without at least one row and one column grouping show as summary reports on the report run page.

-> Joined: Joined reports let you create multiple report blocks that provide different views of your data. Each block acts like a “subreport,” with its own fields, columns, sorting, and filtering. A joined report can even contain data from different report types.


2. What are different kinds of dashboard component?

-> Chart: Use a chart when you want to show data graphically.

-> Gauge: Use a gauge when you have a single value that you want to show within a range of custom values.

-> Metric: Use a metric when you have one key value to display.

     * Enter metric labels directly on components by clicking the empty text field next to the grand total.

     * Metric components placed directly above and below each other in a dashboard column are displayed together as a single component.

-> Table: Use a table to show a set of report data in column form.

-> Visualforce Page: Use a Visualforce page when you want to create a custom component or show information not available in another component type.

-> Custom S-Control: Custom S-Controls can contain any type of content that you can display or run in a browser, for example, a Java applet, an ActiveX control, an Excel file, or a custom HTML Web form


3. What actions can be performed using Workflows?

    Following workflow actions can be performed in a workflow:

-> Email Alert:
    Email alerts are workflow and approval actions that are generated using an email template by a workflow rule or approval process and sent to designated recipients, either Salesforce users or others. Workflow alerts can be sent to any user or contact, as long as they have a valid email address.

-> Field Update:
    Field updates are workflow and approval actions that specify the field you want updated and the new value for it. Depending on the type of field, you can choose to apply a specific value, make the value blank, or calculate a value based on a formula you create.

-> Task:
     Assigns a task to a user you specify. You can specify the Subject, Status, Priority, and Due Dateof the task. Tasks are workflow and approval actions that are triggered by workflow rules or approval processes

-> Outbound Message:
    An outbound message is a workflow, approval, or milestone action that sends the information you specify to an endpoint you designate, such as an external service. An outbound message sends the data in the specified fields in the form of a SOAP message to the endpoint.


4. What are groups in SFDC and what is their use?

    Groups are sets of users. They can contain individual users, other groups, the users in a particular  role or territory, or the users in a particular role or territory plus all of the users below that role or  territory in the hierarchy.

    There are two types of groups:

    Public groups: Only administrators can create public groups. They can be used by everyone in the organization.

    Personal groups: Each user can create groups for their personal use.

    You can use groups in the following ways:

     -> To set up default sharing access via a sharing rule.
     -> To share your records with other users.
     -> To specify that you want to synchronize contacts owned by others users.
     -> To add multiple users to a Salesforce CRM Content library.
     -> To assign users to specific actions in Salesforce Knowledge.

5. What is Visualforce View State?

    Visualforce pages that contain a form component also contain an encrypted, hidden form field that  encapsulates the view state of the page. This view state is automatically created, and as its name  suggests, it holds the state of the page – state that includes the components, field values and  controller state.

- > 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.

-> All public and private data members present in Standard,Custom and Controller extensions are  saved.

-> The transient variables are not passed to view state and therefore not stored in View State.


6. Which objects can be imported by Import Wizard?

    Following objects can be imported using import wizard.

    Accounts 
    Contacts
    Leads
    Solutions 
    Custom Objects


7. What is Profile and Components?

    Profile contains user permissions and access settings that control what users can do within their  organization.

    A collection of settings and permissions that define how a user accesses records

–  Determines how users see data and what they can do with in the application.
–  A profile can have many users, but a user can have only one profile.

    Profiles Components:

    -> Which standard and custom apps users can view
    -> Which tabs users can view
    -> Which record types are available to users
    -> Which page layouts users see 
    -> Object permissions that allow users to create, read, edit and delete records
    -> Which fields within objects users can view and edit
    -> Permissions that allow users to manage the system and apps within it.
   -> Which Apex classes and Visualforce pages users can access
   -> Which desktop clients users can access
   -> The hours during which and IP addresses from which users can log in.
   -> Which service providers users can access (if Salesforce is enabled as an identity provider)

8. What is Permission Set?

    Permission Set 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.

    Every Permission Set is associated with a user license. You can only assign permission sets to users who have the same user license that’s associated with the permission set. If you want to assign similar permissions to users with different licenses, create multiple permission sets with the same Permissions, but with different licenses.

   Permission sets include settings for:

   -> Assigned apps
   -> Object settings, which include:
       * Tab settings
       * Object permissions
       * Field permissions
   -> App permissions
   -> Apex class access
   -> Visualforce page access
   -> System permissions
   -> Service providers (only if you’ve enabled Salesforce as an identity provider)


9. Profile Vs Permission Sets Permissions and Access Settings?

1. User permissions and access settings specify what users can do within an organization.

2. Permissions and access settings are specified in user profiles and permission sets. Every user is assigned only one profile, but can also have multiple permission sets.

3. When determining access for your users, it’s a good idea to use profiles to assign the minimum permissions and access settings for specific groups of users, then use permission sets to grant additional permissions.

10. What are the Standard Profiles available in Salesforce?

-> Standard User – Can view, edit, and delete their own records

-> Solution Manager – Standard User permissions + Can manage published solutions + Can manage categories

-> Marketing User – Standard User permissions + Can import leads for the organization

-> Contract Manager – Standard User permissions + Can edit, approve, activate and delete contracts

-> Read-Only – Can only view records

-> System Administrator – “Super User,” can customize and administer the application


Tools for Lightning Web Component Development

 Below are the tools required for Web Component Development 1. Chrome Browser (Prefered) You can download it from Google 2. Visual Studio Co...