You need to sign in to do that
Don't have an account?
kotipalli srikanth
'Apex class' vs ' Anonymous window code '
Hello, SFDC people.
I am a beginner,
My doubt is that we write the program using APEX Class and also as well as through Anonymous window, what is the difference in writing code on either of them.
please explain me, Thank you.
I am a beginner,
My doubt is that we write the program using APEX Class and also as well as through Anonymous window, what is the difference in writing code on either of them.
please explain me, Thank you.
- They are stored as metadata in Salesforce.
- You can move them between orgs (Sandbo to Production and vice versa, Sandbox to Sandbox etc)
You can read this for detailsAnonymous window:
For details you can follow the below URL
Based on above, answering to your question. You use Apex Classes to write a program that can be called from either visualforce page, triggers etc.
I hope it would have helped you.
Anonymous window code: here we can excute the code by EXECUTE button, example Create a accout object and
Account acc = Account();
acc.name = 'test';
insert acc;
after this code you need to click on execute button, sothat new account will be insert.
APEX CLASS:-
apex class code is dependent with visualforce page, apex trigger, process builder. Apex class can be excute by Anonymous window code for this first need to create this class object in Anonymous window and click Excute button.
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
- You can't write controllers/extensions in anonymous window.
- Apex classes needs to go through testing and deployment offcourse
- Anonyomous window can be used for debuging a existing code, creating and testing a simple logic, can be used to update/analyze data but this should be done carefully.
Anonymous window is friend of developers.
Cheers