You need to sign in to do that
Don't have an account?
NNR
HI friends
trigger insertCategoryScore on Opportunity (before Insert , before Update) {
list<Opportunity> oppt = [select id, Name, StageName,Stage_Reason__c from Opportunity];
List<RecordType> lstRecType = [Select Id, Name from RecordType where sObjectType = 'Opportunity'];
//RecordType lstRecType[] = [Select Id, Name from RecordType where sObjectType = 'Opportunity'];
for (Opportunity opp: oppt){
for(RecordType rec:lstRecType){
if(opp.StageName =='Active Low' && rec.name=='Business1')
opp.Stage_Reason__c = 'Waiting Approval';
//upsert opp;
}
}
insert oppt;
}
ERROR is:Invalid field update at line17
list<Opportunity> oppt = [select id, Name, StageName,Stage_Reason__c from Opportunity];
List<RecordType> lstRecType = [Select Id, Name from RecordType where sObjectType = 'Opportunity'];
//RecordType lstRecType[] = [Select Id, Name from RecordType where sObjectType = 'Opportunity'];
for (Opportunity opp: oppt){
for(RecordType rec:lstRecType){
if(opp.StageName =='Active Low' && rec.name=='Business1')
opp.Stage_Reason__c = 'Waiting Approval';
//upsert opp;
}
}
insert oppt;
}
ERROR is:Invalid field update at line17
Thanks,
SP
Check the type of the field, and re check weather you have access to that field or not.
Regards,
Abhi Tripathi
Salesforce Developer
STAGE RECORDTYPE
ACTIVE LOW Business 1
Prospect
Closed Won
ACTIVE LOW
Prospect
Closed Won