You need to sign in to do that
Don't have an account?
Debjani
Map to identify records inside batchable class
I have a batchable class using which I am sharing groups to cases based on criteria. While I perform this I realize that I will need to fetch the cases
and perform a validation to check which of the cases have sharing already and which do not have. After which I will share groups only to cases which do not have the sharing. How do we achieve this using batch apex?
and perform a validation to check which of the cases have sharing already and which do not have. After which I will share groups only to cases which do not have the sharing. How do we achieve this using batch apex?
Following are the steps I have followed to achive this solution.
Batch Code:
Hope it will help for you. Please let me know incase any queries.
Thanks,
Prem Anandh
All Answers
In this way you will have all the case id's for which sharing records exist. Store these case id's in a set.
Now query all the case records and store id's in another set. Use contains method to find the difference in set 1 and set 2 and store the difference in set 3.
If Multiple Groups are there, then what is the criteria to populate the Group?
Following are the steps I have followed to achive this solution.
Batch Code:
Hope it will help for you. Please let me know incase any queries.
Thanks,
Prem Anandh
Hi Prem,
The criteria lies in querying the case based on a field say ABC which contains value, say "Time" , so it should be shared with only those Groups with name containing "Time".
Your approach is correct. But if I do not create a field on page like you have mentioned , "IsShared" checkbox or do not have any such field to check if it is shared,(we have a button through which we check it) can we use the same way?
I don't think for default option to check the case is already shared or not. So I used custom checkbox to find this criteria.