You need to sign in to do that
Don't have an account?
Kon Dele
Opportunity Probability Stage Trigger
Hi,
How can I write a trigger that would assign a value from a predefined range to the Account number field when: (1) the Opportunity stage moves to 80% (2) the Account Number field is NULL. The trigger should find the highest number in the predefined number range and assign a number +1. So far this is what i have:
trigger AssignAccountNumber on Opportunity (after update){
for (Opportunity p:Trigger.old){
if (p.Probability == 80){
//Should I insert code here that specifies Account number field == 'NULL'
}
}
}
Need some ideas on how I would start this off. Thanks
How can I write a trigger that would assign a value from a predefined range to the Account number field when: (1) the Opportunity stage moves to 80% (2) the Account Number field is NULL. The trigger should find the highest number in the predefined number range and assign a number +1. So far this is what i have:
trigger AssignAccountNumber on Opportunity (after update){
for (Opportunity p:Trigger.old){
if (p.Probability == 80){
//Should I insert code here that specifies Account number field == 'NULL'
}
}
}
Need some ideas on how I would start this off. Thanks
I didnt get the pre-defined range part, like where is this range pre-defined? Anyway, here's a sample apart from the pre-defined range:
Thanks,
Shashank
All Answers
I didnt get the pre-defined range part, like where is this range pre-defined? Anyway, here's a sample apart from the pre-defined range:
Thanks,
Shashank
Just to clarify, the predefined range is defined on the AccountNumber field on the Account object (Account is a lookup on Opportunity) and is to be a number sequence between 10000 and 29999, with the trigger each time assigning the highest number+1 in this range.
Another question of clarification, should it be a before or after trigger.
Thanks,
Kon