function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ashritha ReddyAshritha Reddy 

Some interview questions pls answer me for those which i posted??

1)When should you build solutions declaratively instead of with code?
2)What are the advantages of using Batch Apex instead of a triggers?
3)
When would you use the @future annotation?
4)when did the view state problem is raised what is the pros and cons ?
5)Write a SOQL query that counts the number of active Contacts for each Account in a set.
6)is is possible to write the apex code from userinterface?
7)Can we modify records directly in trigger.new ?
8)why use @Remote Action used before apex method?
9)How to restrict any Trigger to fire only once ?
10)
AJAX  USE In Salesforce how can call ajax in visualforce?
Best Answer chosen by Ashritha Reddy
DeepthiDeepthi (Salesforce Developers) 
Hi Ashritha,

Find few more answers:

2 ) Trigger will invoke when you will do any DML on particular Object . Batch apex you can execute either when you want or you can schedule with a schedule job which will execute with schedule Time .

Incase you have more number of record you need to execute then you should use batch apex which will divide your records into different chunks and execute.

4) Please refer the below link:
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State 

Hope this helps you!
Best Regards,
Deepthi

All Answers

DeepthiDeepthi (Salesforce Developers) 
Hi Ashritha,

Please check the some answers to your questions.

3) Use the future annotation to identify methods that are executed asynchronously. When you specify future, the method executes when Salesforce has available resources.

5) Refer the below code:
Set<Id> stAccIds = new Set<Id>(); //Suppose this set has Account Ids

Map<Id,Integer> accountIdWithContactCount = new Map<Id,Integer>();

for(Account acc : [SELECT Id,Name,(SELECT Id FROM Contacts WHERE Active__c = true) FROM AccountWHERE Id IN :stAccIds]){
   accountIdWithContactCount.put(acc.Id,acc.Contacts.size());

}

8) The RemoteAction annotation provides support for Apex methods used in Visualforce to be called via JavaScript.

9) Make use of a static variable in a helper class. Refer the below link:
https://success.salesforce.com/answers?id=90630000000ggxyAAA

10) AJAX is the art of exchanging data between server and client without reloading the complete web page. And Visualforce has inbuilt support for the AJAX using the attribute “rerender” we can specify that where the response should be rendered. There are few AJAX components in Salesforce, which supports AJAX functionality. They are
Action Function, Action Poller, Action Region,Action Status, Action Support

Hope this helps you!
Best Regards,
Deepthi
DeepthiDeepthi (Salesforce Developers) 
Hi Ashritha,

Find few more answers:

2 ) Trigger will invoke when you will do any DML on particular Object . Batch apex you can execute either when you want or you can schedule with a schedule job which will execute with schedule Time .

Incase you have more number of record you need to execute then you should use batch apex which will divide your records into different chunks and execute.

4) Please refer the below link:
https://developer.salesforce.com/page/An_Introduction_to_Visualforce_View_State 

Hope this helps you!
Best Regards,
Deepthi
This was selected as the best answer
farukh sk hdfarukh sk hd
Hope the below site will help you,


Salesforce Interview questions,

https://www.sfdc-lightning.com/p/salesforce-interview-questions.html
 
Vamsi KrishVamsi Krish
Hi Can you guys please help me how to post a question in developer.salesforce.com