You need to sign in to do that
Don't have an account?
MikeyO
Account Trigger
Hello,
I have a number field on my account object that if greater than 1, I want it to change the account type to "Account Active"
Account Active is currently an option under the picklist field = Type.
What I am currently doing manually is running a report that shows customers with number of subscriptions. If I see one that has 1 or more subscription I have to go and change the account type to "Active Customer" currently it just stays as "Active Prospect" which is the default field.
Is this possible to automate with a trigger?
thank you-
I have a number field on my account object that if greater than 1, I want it to change the account type to "Account Active"
Account Active is currently an option under the picklist field = Type.
What I am currently doing manually is running a report that shows customers with number of subscriptions. If I see one that has 1 or more subscription I have to go and change the account type to "Active Customer" currently it just stays as "Active Prospect" which is the default field.
Is this possible to automate with a trigger?
thank you-
I'll try to learn how to write triggers, I'm kinda new to the whole developer side of SFDC.
Any suggestions as to good material to read/study in order to learn how to write triggers?
If this answers your question, please choose this (or another answer) as the best answer so that it can help others and so that it is remove from the unanswered queue.
[1] http://blog.deadlypenguin.com/blog/2014/07/23/intro-to-apex-auto-converting-leads-in-a-trigger/
[2] http://www.sfdc99.com/beginner-tutorials/
Thank you again for your help!
Something like this should work for your case
there is two sites to learn how to trigger and to write test class
http://www.sfdc99.com/
http://www.salesforcetutorial.com/
if you like this websites give a thumb for answer
thanks,
Sam
I tried what you gave me with a few substitutions to match my fields, but its not working. Any thoughts??
trigger ChangeType on Account (before update) {
for(Account acc:Trigger.new){
if(acc.Active_Subscriptions__c>1 && acc.Type!='Customer - Active'){
acc.Type='Customer - Active';
}
}
}
1) 'Customer - Active' - is this value present in Type picklist
2) Is your trigger active?
3) Add one more event - (before insert,before update)
Please try below code :-
trigger ChangeType on Account (before update,before insert)
{
for(Account acc:Trigger.new)
{
if(acc.Active_Subscriptions__c>1 && acc.Type!='Customer - Active')
{
acc.Type='Customer - Active';
}
}
}
NOTE :- Make sure Type picklist should contain "Customer - Active" picklist value