You need to sign in to do that
Don't have an account?

Trigger
Hi Experts,
Is it possible to execute this trigger in dveloper console without any test class.
example: -
trigger CountFriends on Contact(before insert) {
for (Contact c : Trigger.new) {
// We often use System.debug to see the values of variables
System.debug('mukesh has a new friend!');
System.debug('Hi ' + c.FirstName + ' ' + c.LastName + '!');
}
List<Contact> total = [SELECT Id FROM Contact];
System.debug('mukesh has ' + total.size() + ' friends total.');
}
i am using same trigger in developer console but nothing happeing.
Pls help.
Thank's
Is it possible to execute this trigger in dveloper console without any test class.
example: -
trigger CountFriends on Contact(before insert) {
for (Contact c : Trigger.new) {
// We often use System.debug to see the values of variables
System.debug('mukesh has a new friend!');
System.debug('Hi ' + c.FirstName + ' ' + c.LastName + '!');
}
List<Contact> total = [SELECT Id FROM Contact];
System.debug('mukesh has ' + total.size() + ' friends total.');
}
i am using same trigger in developer console but nothing happeing.
Pls help.
Thank's
You can not execute same code in develiper console...because trigger fires when some event occurs..
Now Logic whihc is inside the trigger , you can execute from developer console...
Let me knwo what exactly you are trying to do..I would advise to go for testclass if you want to test ypur trigger ..test class is very simple to create adn validate our trigger..let me know if you need anything..
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Thanks,
Sandeep
Salesforce Certified Developer
All Answers
In your code, when new Contact record is created in your org, then the trigger code will executed automaticaly.
Thanks,
http://karanrajs.com
You can not execute same code in develiper console...because trigger fires when some event occurs..
Now Logic whihc is inside the trigger , you can execute from developer console...
Let me knwo what exactly you are trying to do..I would advise to go for testclass if you want to test ypur trigger ..test class is very simple to create adn validate our trigger..let me know if you need anything..
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Thanks,
Sandeep
Salesforce Certified Developer
I am beginer in this field ,
I want to test my trigger value in debug mode.
Thank's
If you simply want to debug the values, then you can go to setup and type debuglogs and select the user from which you are logged in and then there you can view all your debug statment whenever your code executes..
Thanks,
Sandeep