You need to sign in to do that
Don't have an account?
madhan bondalapati
i have a field on opportunity.if that is checked i should not edit the record
I have one feild on opportunity ,it is checked the record should not be edited.I
wrote trigger like this ,but it is showing some error.Could anyone help in this
trigger DisableEdit on Opportunity (before update)
{
Set<Id> parentIds=new Set<Id>();
for(Opportunity opp : Trigger.old)
{
parentIds.add(opp.Id);
}
Map<Id, Opportunity> parentMap=new Map<Id, Opportunity>();
parentMap.putAll([Select Id from Opportunity where Oppty_Status__c = 'Closed' and Id in :parentIds]);
for(Opportunity opp : Trigger.old)
{
if (parentMap.get(opp.Id)!= null)
{
opp.addError('You don\'t have Previlege to Edit a Renewal after status is set to Closed');
}
}
}
It is showing error message at the opp.adderror.When i checked the debug log it is not passing that line
wrote trigger like this ,but it is showing some error.Could anyone help in this
trigger DisableEdit on Opportunity (before update)
{
Set<Id> parentIds=new Set<Id>();
for(Opportunity opp : Trigger.old)
{
parentIds.add(opp.Id);
}
Map<Id, Opportunity> parentMap=new Map<Id, Opportunity>();
parentMap.putAll([Select Id from Opportunity where Oppty_Status__c = 'Closed' and Id in :parentIds]);
for(Opportunity opp : Trigger.old)
{
if (parentMap.get(opp.Id)!= null)
{
opp.addError('You don\'t have Previlege to Edit a Renewal after status is set to Closed');
}
}
}
It is showing error message at the opp.adderror.When i checked the debug log it is not passing that line
Shikha Agashi
Try following code: