How to set CreatedDate for records in Test Class in Salesforce?

setCreatedDate() can be used to set CreatedDate for records in Test Class in Salesforce.

Sample Code:

        insert a;
        Test.setCreatedDate(a.Id, DateTime.newInstance(2012,12,12));


1. Don't use seeAllData=true.

2. Make sure setCreateDate method is called before Test.start method.


Parameter required: feedElementId

To fix Parameter required: feedElementId issue, make sure Feed Item Id is passed. Put debug log and check and make sure Feed Item Id is passed.


Salesforce Interview questions with answers Part 34

1. What is the scope of the project?

To define the scope of the project, it is important to identify the following:
1. Project objectives.
2. Goals.
3. Sub-phases.
4. Tasks.
5. Resources.
6. Budget.
7. Schedule.

2. How many application have you developed for this project and what is the purpose of this application? How did the business benefit from these applications?

Explain the business process of the project. For example, if it is an Service Application, we can explain how Customer Queries are resolved. If it is an Sales Project, we can explain how Sales Process is implemented. If it is a Marketing Application, we can explain how marketing process is implemented.

3. What were some of the challenges you encountered during the development of the applications? How did you over come it? Give me some specific examples?

1. Governor limit
2. Test class failures due to recent changes
3. Token expiration

4. What is the daily routine of a Salesforce developer?

1. Solving Tickets
2. Taking Backup of code
3. Committing changes to SVN
4. Addressing users requests

5. During your production support time - did you find any incidents recurring? If so, how did you resolve to stop recurring incidents? Give examples of incidents?

Prepare a document for recurring tasks and send them to the users.

6. Give some examples of SOSL and SOQL?

7. As a salesforce developer, give me scenarios where I would use SQL queries to analyze what?

8. Give me examples or scenarios where you would need to integrate Salesforce applications with other web applications? 

1. Synchronizing data with external data base
2. Sending information to third party data base

9. What type of services works well to integrate Salesforce application with other application?SOAP or REST? Why?


How to deploy components using MavensMate for Salesforce?

1. Create the debug log using the below link.

2. Go to MavensMate --> Deploy to Server.

3. Enter the name.

4. Enter the destination org username and password and click "Create Connection".

5. You will be able to see the created connection.

6. Select the components to deploy.

7. Click "Validate Deployment".

8. Click "Finish Validate Deployment".

9. Click "Deploy to Server".


How to add debug log in MavensMate?

1. Go to MavensMate --> Debugging --> New Trace Flag.

2. Enter the details and click "Create Log" button.