You need to sign in to do that
Don't have an account?
Kathryn Bullock
I have zero idea of what I am doing and I am recieving the eror message "Unexpected token 'for'"
Unexpected Token 'for'
for (Opportunity objOpp : opportunities){ if(objOpp.Owner.ProfileId == 'System Administrator') { trigger OpportunityTrigger on Opportunity (before insert) { if(Trigger.isBefore && Trigger.isInsert){ DedupeCasesHandler.deDupeCases } }
I have zero idea of what I am doing and I am recieving the eror message "Unexpected token 'for'"
All Answers
You Are doing completly wrong thing in your code try learn something.
You started For Loop and inside for loop you are writing trigger. Please see trigger writing syntex so you will get exectly what you are doing.
Thanks
Hemant
trigger triigername on object(before insert)
{ // your logic
}
try above code snippit.
All of the curly brackets are matching and I have indented and there are stil errors.
And this associated class:
Why is this telling me that the variable does not exist? And what exactly do I have to do to fix this problem?
(DedupeCasesHandler.deDupeCases); -- This is incoorect
DedupeCasesHandler.deDupeCases(Listopportunity);
And also donot write soql query in loop
trigger NoTwoOpps on Opportunity (before insert){
List<opportunity> opps = new List<opportunity>();
Profile p=[SELECT ID, Name FROM Profile WHERE Id=:userinfo.getProfileId() LIMIT 1];
for (Opportunity o: Trigger.new){
if(o.AccountId!=null && o.createdDate>=system.now().adddays(-90)) {
if(p.Name<>'System Administrator')
{
opps.add(o);
DedupeCasesHandler.deDupeCases(o);
}
}
}
}
Please rewrite it as
List< Opportunity> u=[Select ID, Oppty_Type__c,Opport_Acct_SF_ID__c FROM Opportunity WHERECreatedDate=Last_90_DAYS];