0% found this document useful (0 votes)
2 views

public class Accountclass {

The document contains a Java class 'Accountclass' with methods to update account ratings based on annual revenue and customer priority, as well as to set account types to specific SLA levels. The 'updateAccountRating' method assigns ratings of 'cold', 'warm', or 'hot' based on annual revenue and adjusts ratings based on customer priority. Additionally, a trigger 'AccountTr' is defined to call the rating update method before account insertions or updates.

Uploaded by

sujatha.sirigiri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

public class Accountclass {

The document contains a Java class 'Accountclass' with methods to update account ratings based on annual revenue and customer priority, as well as to set account types to specific SLA levels. The 'updateAccountRating' method assigns ratings of 'cold', 'warm', or 'hot' based on annual revenue and adjusts ratings based on customer priority. Additionally, a trigger 'AccountTr' is defined to call the rating update method before account insertions or updates.

Uploaded by

sujatha.sirigiri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

public class Accountclass {

public static void updateAccountRating(list<Account> listAccount)


{ //task 52
for(Account ac:listAccount ){
if( ac.AnnualRevenue <1000000){
ac.Rating = 'cold';

} else if (ac.AnnualRevenue >= 1000000 && ac.AnnualRevenue <=


5000000) {
ac.Rating = 'warm';
} else if (ac.AnnualRevenue >5000000) {
ac.Rating = 'hot';
system.debug('Account rating value =='+ ac.Rating);

} if(ac.CustomerPriority__c == 'hot'){ //task 53


ac.Rating = 'high';
}
else if (ac.CustomerPriority__c == 'warm') {
ac.Rating = 'medium';
}
else if (ac.CustomerPriority__c == 'cold') {
ac.Rating = 'low';
}
}
}
public static void updateAccounttype(list<Account> listAccount){
//task 54
for(Account ac:listAccount ){
if (ac.Type == 'Prospect') {
ac.SLA__c = 'bronze';
} else if (ac.Type == 'Customer - Direct') {
ac.SLA__c = 'Gold';
} else if (ac.Type == 'Customer - Channel') {
ac.SLA__c = 'silver';
} else if (ac.Type== 'Partners / Resellers') {
ac.SLA__c= 'Platinum';

}
}
}
}
trigger AccountTr on Account(before insert,before update,before delete,after
insert,after update,after delete) {
if(trigger.isbefore &&(trigger.isinsert || trigger.isupdate) ){
Accountclass.updateAccountRating(trigger.new);
// Accountclass.updateAccounttype(trigger.new);

}
}

You might also like