You need to sign in to do that
Don't have an account?
liron169
Sharing rules calculation
Hi,
We have several objects that calculation of their sharing rules done in apex code.
This code is complex and dirty and hard to maintain. So I review it - and found option to move it into the UI - means calculate it with sharing rules base criteria.
There are 2 optional problem:
1.We might need to increase the available sharing rules criteria. Current limit is 50, and SF support already confirm that we can increase it, but the concern is if it will affect performance significantly?
(currently we will have 20 criteria, but in future it might increase to ~60)
2.Might need to use complex criteria. Would that reduce the performance significantly?
e.g.: (6 AND ((2 AND (3 OR 4 OR 5)) OR (1 AND 3))) OR (7 AND 8)
Does someone have exprience with this and can advise?
Thanks.
We have several objects that calculation of their sharing rules done in apex code.
This code is complex and dirty and hard to maintain. So I review it - and found option to move it into the UI - means calculate it with sharing rules base criteria.
There are 2 optional problem:
1.We might need to increase the available sharing rules criteria. Current limit is 50, and SF support already confirm that we can increase it, but the concern is if it will affect performance significantly?
(currently we will have 20 criteria, but in future it might increase to ~60)
2.Might need to use complex criteria. Would that reduce the performance significantly?
e.g.: (6 AND ((2 AND (3 OR 4 OR 5)) OR (1 AND 3))) OR (7 AND 8)
Does someone have exprience with this and can advise?
Thanks.
Lot sharing rules are not recommended. Now if we apply it using code then also there will be an impact on performance, so i am advising you to go for apex coding and check is it having significant impact on performance.
All Answers
As per best practice it is advised to have minimum number of sharing rules. I would suggest you to go by second approach instead of increasing number of sharing rules.
Also you can test it out in sandbox/ test org first.
What do you mesn by second approach?
The other approach will be to keep using apex code.
I can replace the code by using both number of criteria, and each criteria might need complex logic.
Should I keep it in the code?
Lot sharing rules are not recommended. Now if we apply it using code then also there will be an impact on performance, so i am advising you to go for apex coding and check is it having significant impact on performance.
Indeed I'll do some tests on performance, of with code/sharing rules, and then decide
I almost didn't notice change in performance at all.
I'll keep testing it