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
Hitesh KhannaHitesh Khanna 

How do i exclude my custom permission for this validation rule ?

AND(ISPICKVAL(Status__c , 'Pharma Payment'), ISBLANK(InvoiceFile__c), RecordType.DeveloperName ='With_Invoicing',NOT(ISNEW()))
custom permission is :    $Permission.Bypass_Rebate_Payment_Status_Change_Validation 

where and how do i put this inside my validation rule to exclude it ?
 
Best Answer chosen by Hitesh Khanna
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Hitesh,

Did you tried the below.
 
AND( $Permission.Bypass_Rebate_Payment_Status_Change_Validation=False ,ISPICKVAL(Status__c , 'Pharma Payment'), ISBLANK(InvoiceFile__c), RecordType.DeveloperName ='With_Invoicing',NOT(ISNEW()))

Thanks,
​​​​​​​


All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Hitesh,

Can you please find the below article where the usage of custom permission in validation rules is explained.

https://unhandledsunshine.com/2018/12/06/use-custom-permissions-to-bypass-validation-rules-and-pass-unit-tests/

If this solution helps, Please mark it as best anaswer.

Thanks,
 
Hitesh KhannaHitesh Khanna
Thanks sai
I have read it already but i am not getting how to use it in my particular validation rule.
 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Hitesh,

Did you tried the below.
 
AND( $Permission.Bypass_Rebate_Payment_Status_Change_Validation=False ,ISPICKVAL(Status__c , 'Pharma Payment'), ISBLANK(InvoiceFile__c), RecordType.DeveloperName ='With_Invoicing',NOT(ISNEW()))

Thanks,
​​​​​​​


This was selected as the best answer