You need to sign in to do that
Don't have an account?
Sanu Verma
when i try to create task and events in same opportunity in test class duplicate id error occured.
In a test class i tried to create task and events in same opportunity, but when i tried to do so duplicate id error occured.
Here is my code:
Here is my code:
Opportunity opp1 = UtilityTest.getOpportunity(acc.Id); insert opp1; Task[] tasks = new Task[]{ new Task(Subject = 'Call',Ownerid=userInfo.getUserId(), Status = 'In Progress', WhatId = opp1.Id, Priority = 'Normal'), new Task(Subject = 'Call',Ownerid=userInfo.getUserId(), Status = 'In Progress', WhatId = opp1.Id, Priority = 'Normal') }; insert tasks; Event[] evs = new Event[]{ new Event(Subject = 'Call',Ownerid=userInfo.getUserId(), WhatId = opp1.Id, StartDateTime = date.today()+1,EndDateTime = Date.today()+2), new Event(Subject = 'Call',Ownerid=userInfo.getUserId(), WhatId = opp1.Id, StartDateTime = date.today()+1,EndDateTime = Date.today()+2) }; insert evs; update opp1;
I tested your code and its working correct. I think some problem in your class UtilityTest.
Check below code for your reference. And again you face same issue then please share UtilityTest class to me.
Hope this will help you. Let me know if it helped or you need any more assistance.
Please mark this is as the solution if it solved your purpose.
Thanks,
Sohan Raj Gupta
caused by: System.ListException: Duplicate id in list: 00629000006fhxBAAQ
every time this error occured and this is my Event Trigger
in this method where i want to create task and events in opp".deleteMaxDateCollection".