You need to sign in to do that
Don't have an account?
SUMANTH ELLURU
o make Account ‘Active’ once any opportunity associated to it reaches ‘Qualification’ stage.
Create an insert/update trigger on Opportunity such that when the Opportunity Stage = ‘Qualification’, check if the corresponding Account field IsActive status = true. If IsActive=false then update IsActive=true.
Note: ‘IsActive’ is not a standard field. Create a custom checkbox field named ‘IsActive’ on Account before proceeding with the trigger
Note: ‘IsActive’ is not a standard field. Create a custom checkbox field named ‘IsActive’ on Account before proceeding with the trigger
er UpdateNoOfContact on Contact(after insert){
try{
Log_Error__c logObj = new Log_Error__c();
List<Account> accListToBeUpdated = new List<Account>();
Map<ID,Account> accMap = new Map<ID,Account>([SELECT id,name,No_Of_Contacts__c FROM Account WHERE id in :accListToBeUpdated]);
for(Contact con : Trigger.new){
Account acc = new Account();
if(con.AccountId != NULL){
acc = accMap.get(con.AccountId);
if(acc.No_Of_Contacts__c == NULL){
acc.No_Of_Contacts__c = 1;
}
else{
acc.No_Of_Contacts__c += 1;
}
}
accListToBeUpdated.add(acc);
}
if(accListToBeUpdated.size() > 0){
update accListToBeUpdated;
}
}
catch(DMLException dmlEx){
Log_Error__c logObj = new Log_Error__c();
logObj.Exception_Message__c = dmlEx.getMessage();
logObj.Line_Number__c = dmlEx.getLineNumber();
logObj.Type_of_exception__c = dmlEx.getTypeName();
INSERT logObj;
}
catch(Exception expMsg){
Log_Error__c logObj = new Log_Error__c();
logObj.Exception_Message__c = expMsg.getMessage();
logObj.Line_Number__c = expMsg.getLineNumber();
logObj.Type_of_exception__c = expMsg.getTypeName();
INSERT logObj;
}
}
Compile Error: Trigger name, UpdateNoOfContact, exists on different SObject type: Account at line -1 column -1