Is there any way with which I can check what all the places a specific public group is used for and then delete the public groups in Salesforce?
There is no way to identify where all places any Public Group created is used in Salesforce.com.
The public group can be used at -
- Sharing Rules
- Record Sharing
- Queues
- List Views
- Other Public Groups (nested)
- Report Folders access
- Document Folder access
- Library sharing
But it is strange to me that I can delete the public group from the Salesforce.com instance which is in use; say in "Sharing Setting"! And the effect of this is that the Sharing setting entry also gets deleted without informing me!
Is there any way with which I can check what all the places a specific public group is used for and think of an alternate option and then delete the public group from Salesforce.com?
Yes sure, you can check what all the places a specific public group is used for and then delete the public groups in Salesforce.
You can use SOQL like below to get a list of Accounts with which the record has been shared and the Cause(Rule, Manual etc).
SELECT ID, AccountId , IsDeleted, RowCause FROM AccountShare WHERE UserOrGroupId='???????'
You can repeat this for all custom and standard objects and you can get the list of objects itself from the following query.
list allObjects = Schema.getGlobalDescribe().Values();
This will tell you the records of different objects which are shared with the group. As long as you would like to know only records which are shared, this approach is good enough.