Posts

Showing posts from April 25, 2019

Multiple OR (||) Conditions in If Statement

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0; } 1 Can anyone explain why the following If statement does not work with multiple OR conditions. The goal is when this trigger runs, if the user's Id who is updating the record is not equal to a specific Id, then an error is thrown. The If clause works only when I compare the current user's Id with a single specific Id. String currentUserId = UserInfo.getUserId(); if (currentUserId != 'XXXXXXXXX' || currentUserId != 'YYYYYYYYY' || currentUserId != 'ZZZZZZZZZ') { Trigger.new[0].addError('Only specific users are able to change the Account Classification Field'); } {EDIT} FYI: I know I can accomplis...