You need to sign in to do that
Don't have an account?
Chaitra GV
Sharing a record using Apex code
Hi,
I had a query related to sharing a record
There are two fields in a record and in that you want that if the total of field is 100 or more then share the record with the user else if it less then keep it in private only
Can you please tell me how to do this using apex?
I had a query related to sharing a record
There are two fields in a record and in that you want that if the total of field is 100 or more then share the record with the user else if it less then keep it in private only
Can you please tell me how to do this using apex?
Share object is: <ObjectName>Share -> AccountShare
ParentId is replace by <ObjectName>Id -> AccountId
Details: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunityshare.htm
Custom Object: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm
Please mark this as Best Answer, if this helps solve your problem.
All Answers
Share object is: <ObjectName>Share -> AccountShare
ParentId is replace by <ObjectName>Id -> AccountId
Details: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_opportunityshare.htm
Custom Object: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm
Please mark this as Best Answer, if this helps solve your problem.
we can achieve this using Apex trigger in the required object.
Please find the below post which might help you in understanding with full end to end coding for the similar scenioros.
Apex sharing based on criteria (http://salessforcehacks.blogspot.com/2020/01/apex-managed-sharing-with-real-time.html)