You can write method inside trigger .Basically if you write private static method inside trigger will be good as we can not call the trigger method from out side the trigger .
You can test below example :
trigger AccountTrigger on Account(before Insert ){
private static string getCurrentUserProfileName(){
return [SELECT Name FROM Profile where id = :Userinfo.getProfileId()].Name;
}
}
You can use thid method to check the profile name .
You can write method inside trigger .Basically if you write private static method inside trigger will be good as we can not call the trigger method from out side the trigger .
You can test below example :
trigger AccountTrigger on Account(before Insert ){
private static string getCurrentUserProfileName(){
return [SELECT Name FROM Profile where id = :Userinfo.getProfileId()].Name;
}
}
You can use thid method to check the profile name .
You can write method inside trigger .Basically if you write private static method inside trigger will be good as we can not call the trigger method from out side the trigger .
You can test below example :
You can use thid method to check the profile name .
Let me know if it helps .
Thanks
Manoj
All Answers
Please see below code for example :-
http://amitsalesforce.blogspot.in/2015/06/trigger-best-practices-sample-trigger.html
Please let us know if this will help you
Thanks
Amit Chaudhary
You can write method inside trigger .Basically if you write private static method inside trigger will be good as we can not call the trigger method from out side the trigger .
You can test below example :
You can use thid method to check the profile name .
Let me know if it helps .
Thanks
Manoj