You need to sign in to do that
Don't have an account?
jishan roy
when opportunity description field update then all opportunity description field shows in account description field using trigger
Hii @all
can anybody help me to out of this question,
when opportunity description field update then all opportunity description field shows in account description field using trigger.
can anybody help me to out of this question,
when opportunity description field update then all opportunity description field shows in account description field using trigger.
Do you need to update all the opportunity descriptions on account desciption using Trigger?
Thanks,
yes i need to update all opportunity description on account desciption using trigger.
Set<Id> accountIds = new Set<Id>();
for (Opportunity opp : Trigger.new) {
Opportunity oldOpp = Trigger.oldMap.get(opp.Id);
if (opp.Description != oldOpp.Description) {
accountIds.add(opp.AccountId);
}
}
if (accountIds.size() > 0) {
List<Account> accountsToUpdate = [SELECT Id, Description FROM Account WHERE Id IN :accountIds];
for (Account acc : accountsToUpdate) {
acc.Description = Trigger.newMap.get(acc.Id).Description;
}
update accountsToUpdate;
}
}