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
Surender reddy SalukutiSurender reddy Salukuti 

how can i by pass validation rule for one profile ?

Hi all ,

I have one requirement i need to bypass validation rule for one profile using apex class code not trigger how can i do that .
can any one help me on this 

 

Frederick Wolfe 9Frederick Wolfe 9
Thanks for sharing, I found a lot of interesting information here. A really good post, very thankful and helpful that you will write many more posts like this one.

PrepaidCardStatus (https://www.prepaidcardstatus.org/)
Andrew GAndrew G
Profile p = [Select Name from Profile where Id =: userinfo.getProfileid()];
String pname = p.name;

the above will pull the profile name for the current user.
Then just do a IF statement around the trigger element you want to skip.

cheers
Andrew
Shubham Raj 29Shubham Raj 29

Hi @Surender reddy Salukuti,

You can add conditions to filter or bypass the logic in this way-

if ( Your Contionditions && !profileName.equals('CLI Broker User')) { 

                // Your Code and Logics
}

 

Let me know if this was helpful. If it does, please mark it as Best Answer to help others too.

Thanks,

Shubham Raj