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
Manisha PatilManisha Patil 

Can we use one transaction security policy for exporting data from multiple objects?

Hi,
I have 4 diff Data Export policies for Lead, Account, Opportunity and Contact object with diff apex classes. 
I would like to know if there is a way to create one single apex class that I can use in one single policy instead of 4 duplicates .
Also, is it possible to use custom settings in policies to store the threshold value of number of records? everytime, i try to access the custom settings in policy apex class, the test class fails.

Thanks,
​Manisha
VivekGuptaVivekGupta
It seems there is no way to have a single policie. I did try to compare the entity name with all the objects in a single class but it didn't wokreded out.
You can use custom labels Label.LabelName to make sure your code is flexible.