18 lines
518 B
Plaintext
18 lines
518 B
Plaintext
trigger CategorizedOpprtunity on Opportunity (before insert, before update) {
|
|
for (Opportunity opp : Trigger.New)
|
|
{
|
|
if (opp.Amount != null)
|
|
{
|
|
if (opp.Amount < 10000)
|
|
{
|
|
opp.Category__c = 'Small';
|
|
}
|
|
else if (opp.Amount >= 10000 && opp.Amount < 50000)
|
|
{
|
|
opp.Category__c = 'Medium';
|
|
} else if (opp.Amount >= 50000) {
|
|
opp.Category__c = 'Large';
|
|
}
|
|
}
|
|
}
|
|
} |