function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Advanced Admin: Explore Custom Transaction Security Policies - Issue with first test class

Hi All,

In attempting to compile the first test class provided in the 'Explore Custom Transaction Security Policies' module, I receive 2 compile errors.

The first was around line 29, where the semi colon beside eventData needs to be moved outside of the right parenthesis.

However after trying to compile after that change there is another error complaining that the platform field of the LoginHistory object (declared as loginHistoryObj for our instance) is not writeable.  Below are the lines of importance...

    /* Create a history object that has Platform = Android 4. */
    LoginHistory loginHistoryObj = new LoginHistory();
    loginHistoryObj.Platform = 'Android 4';  <----
this is where the compile is complaining (Error: Compile Error: Field is not writeable: LoginHistory.Platform at line 7 column 5)

I checked the LoginHistory Object documentation, and it looks like it should be writeable to me.

Does anyone have any suggestions? or is this a bug of some sort?

Jeff DouglasJeff Douglas

Check this unit again as I think some of the requirements may have changed with yesterday's Trailhead update.

Jeff Douglas
Trailhead Developer Advocate

Hi Jeff,

Thanks for the response, I tried to complie again and I am still reciving the same issues.

Semi colon in wrong place and LoginHistory.Platform is not writable.



Doug DunfeeDoug Dunfee
Also getting the LoginHistory.Platform is not writable error.  Tweeting @Trailhead.
Sean Gorman 1Sean Gorman 1
Me too. Same error, same potition.
Me too. Same errors.
Doug DunfeeDoug Dunfee
They asked to use the feedback link on the module (believe I already did).
Beth HowardBeth Howard
Yep, same error here - looks like this module hasn't been fixed yet. I also filled in the feedback link. Note, the challenge to pass the unit is multiple-choice, but it would be nice if the code worked!
Diana ManDiana Man
I'm having the same error here, that one plus a semi-colon in a bad position.
Diana ManDiana Man
Also, if I comment that line, I got another error:
DML operation INSERT not allowed on LoginHistory
Stephan H. WisselStephan H. Wissel
Same error still persists
Same here...trying to follow along and implement the example as it's laid out in the Trailhead and the Test code flat out doesn't work.