Skip to main content
16 events
when toggle format what by license comment
Jan 30, 2015 at 15:01 comment added Koen Wesselman Oops, you're right.. The profile should be available without SeeAllData=true.. I must admit that in that case I'm not sure either :-)
Jan 30, 2015 at 12:25 comment added Jarvis Hi @Koen Please advise what do you mean by mock the profile. Doesn't setup data is available with or without (SeeALLdata = true) ?
Jan 30, 2015 at 11:15 comment added Koen Wesselman You're selecting a Profile, which you can only see when seeAllData equals true. You could mock the Profile instead.
Jan 29, 2015 at 11:50 comment added Jarvis I have changed the method definition of CreateUserRole() to insert the role and also of CreateUser() to soql the profile and insert the user but it still throws the same exception. My question - why does annotating the class with (seealldata=true) doesn't throw any exception ?
Jan 29, 2015 at 10:32 comment added Koen Wesselman UserRoleId = ur.Id, you use this line in CreateUser() but you don't set ur.Id in CreateUserRole(). If you want your UserRole to have an Id you need to insert it first and then use a SELECT query to retrieve it's Id.
Jan 29, 2015 at 1:30 comment added Jarvis here is the log @Koen EXCEPTION_THROWN [15]|System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, CountLimit: execution of AfterInsert EXCEPTION_THROWN caused by: System.NullPointerException: Attempt to de-reference a null object
Jan 28, 2015 at 7:51 comment added Koen Wesselman Can you tell me which line it's pointing to?
Jan 28, 2015 at 4:34 comment added Jarvis Hi @Koen, I have changed my test class as per your advice but still it's not working out until I annotate it with (seealldata=true). Please see the code below.
Jan 24, 2015 at 19:58 comment added Koen Wesselman At first sight I think it's related to the query for the thisUser variable. Why are you inserting the test user as a different user? Also, you're currently not using System.assert() anywhere. Have a look at that method in relation to test methods.
Jan 24, 2015 at 13:54 comment added Jarvis Koen, I think I get the issue here, until I annotate with @isTest(seealldata=true) I keep on getting this error.
Jan 24, 2015 at 12:11 comment added Jarvis hi @Koen, could you please help me in the test class below?It's throwing System.NullPointerException.
Jan 21, 2015 at 9:45 vote accept Jarvis
Jan 21, 2015 at 8:22 comment added Koen Wesselman No problem! If you decide to use after-events only, you can leave your code the way it is. I have updated my answer with a short explanation of what to do to get the dynamic messages to work, do you need an example?
Jan 21, 2015 at 8:21 history edited Koen Wesselman CC BY-SA 3.0
added 184 characters in body
Jan 21, 2015 at 6:32 comment added Jarvis Thanks @koen, so I was defying logic here and it's best to put this handler under the events (after insert, after update, after undelete) for this particular scenario. Could you please advise on dynamic error message I mentioned in my original post? Because the error message converts to 'You can't open more than 3 incidents for null null'
Jan 20, 2015 at 18:51 history answered Koen Wesselman CC BY-SA 3.0