You need to sign in to do that
Don't have an account?
Rajendra Pogiri
apex after insert trigger error . please help
sir/mam, i wrote a after trigger code for :- if the amount is greater than 50,000 then the opportunity record should be shared with another user, so i in program at query i took the user-id where euals to ALIAS name. this is working fine. But problem is if write the query for LASTNAME instead of ALIAS name, then i am getting error,, please help.....
trigger afterinsertTrigger on Opportunity (after insert) { list share=new list(); user u=[select id from user where lastname='pogiri']; for(Opportunity op:Trigger.New){ if(op.amount>50000){ Opportunityshare s=new Opportunityshare(); s.OpportunityId=op.id; s.OpportunityAccessLevel='Edit'; s.RowCause='Manual'; s.UserOrGroupId=u.id; share.add(s); } } insert share; }
Issue in your trigger is that in your org you have more then 1 user with pogiri last Name.
Please let us know if this will help you
Thanks
Amit Chaudhary