You need to sign in to do that
Don't have an account?
Anonymouse
Sincerely,
Jackie
How to Create Example Test Class to Test Event Trigger
Hello,
I currently have an Event Trigger and the code coverage is only 80%. I need to assign the WhatID for an event. How may I do this with a test class? This is what I have so far:
... Event someEvent = new Event(Subject = 'Test', ActivityDate = date.today(), StartDateTime = System.Now(), EndDateTime = System.Now() + 5, whatId = ???); ...Do I need to get the whatID from a User, Account, Contact, or something else? Any help is greatly appreciated!
Sincerely,
Jackie
In your test class, insert an Account before Event, use the newly inserted accounts Id in WhatId field.
If this solves your problem, please mark this as BEST ANSWER
All Answers
In your test class, insert an Account before Event, use the newly inserted accounts Id in WhatId field.
If this solves your problem, please mark this as BEST ANSWER