+ Start a Discussion
Gerardo AnasagastiGerardo Anasagasti 

How can we Deploy and Retrieve a __share for a custom object with ANT

Hello,  we are going to start to restrict some objects sharing, and we found that we cannot create the __share custom metadata for the objects, as per the documentation, salesforce creates them when the sharing of the objet is changed from public.

Our concer is that we have a metadata repository to store all our project metadata, and to use it to deploy at our different orgs (Dev, Int, Pre) prior to deploy to prod, but so far, we are not able to find the metadata type to be used with ANT to download this custom metadata named "...__shared"
Not sure if is because this is not available, or if it has a different metadata type. We just want to generate the __share, extract it with ANT from one Sandbox, and upload to a different one with ANT (if this is not possible, almost to get it from the sandbox and store it at our repository)
Best Answer chosen by Gerardo Anasagasti
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Gerardo

Share objects do not have any independent file when you try to retrieve them through metadata api.
The share object details are captured in object and sharing settings files.
For deployment if you deploy these files all your necessary settings get deployed.

Cheers!!!

All Answers

Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Gerardo

Share objects do not have any independent file when you try to retrieve them through metadata api.
The share object details are captured in object and sharing settings files.
For deployment if you deploy these files all your necessary settings get deployed.

Cheers!!!
This was selected as the best answer
Gerardo AnasagastiGerardo Anasagasti
Hi Syed, many thanks, for the quick response!
Yeah I was thinking something like that has to be happening. 

So thanks again for solving our doubt.
Raj VakatiRaj Vakati
Sharing is the standard type that will create for every custom object if the object as part of metadata ..If the object is private or public read-only 

You no need to deploy them explicitly and it will be part of object migration