function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nagalakshminagalakshmi 

How to use the apex sharing settings

Hi, 

 

How to use the apex sharing settings.  I saw the code for apex sharing settings in

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_creating_with_apex.htm

 

i use this code i got the error as

 

Error: Compile Error: sObject type 'job__share' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 90 column 32

 

How can i create job_share. Any one please help me for solving this. 

 

Thanks,

Lakshmi.


Best Answer chosen by Admin (Salesforce Developers) 
aruna11.3081223889641084E12aruna11.3081223889641084E12

Hi, It seems you are trying to copy paste the code from the link.

 

If it is the case, please create those fields which are used in class or trigger with the same API names as they are used in code.

 

For this perticular error, you need to create Hiring_Manager__c field on job object which will be lookup to the user object in salesforce.

 

As we see the trigger code, there are other fields also, which are used in code. Please create them in your org before using in the code to avoid the errors.

 

Hope this helps.

All Answers

aruna11.3081223889641084E12aruna11.3081223889641084E12

Hi,

 

For creating shraing object, you need to activate sharing on the base object.

Goto Admin setup--> Security controls--> sharing settings.

Here you will get all the objects to activate sharing on.

Click edit on this page, Goto job object, and mark default access as "private" or "public read only" and save.

 

This will activate Job__share object in in the background.

Then only you can fetch the data or insert the data into this sharing object.

 

 

 

nagalakshminagalakshmi

 

Hi aruna,

Thanks for your reply. its working fine. when i am use the trigger which i have mentioned  in the link i got the error as

 

Error: Compile Error: Invalid share row cause:hiring_manager__c at line 37 column 30

 

how can i create hiring_manager__c. Please help me out.

 

Thanks,

Lakshmi.

 

 

 

 

 

 

aruna11.3081223889641084E12aruna11.3081223889641084E12

Hi,

 

Can you please mark  the post as solution if it has resolved your previosly stated problem.

aruna11.3081223889641084E12aruna11.3081223889641084E12

Hi, It seems you are trying to copy paste the code from the link.

 

If it is the case, please create those fields which are used in class or trigger with the same API names as they are used in code.

 

For this perticular error, you need to create Hiring_Manager__c field on job object which will be lookup to the user object in salesforce.

 

As we see the trigger code, there are other fields also, which are used in code. Please create them in your org before using in the code to avoid the errors.

 

Hope this helps.

This was selected as the best answer
eeshaeesha

hi aruna and lakshmi,

   

                i am also seeking for the same thing which you have sent. its working fine. But facing some problem. If i share job object to the particular user, that object is not visible in user's account. But it will shows the object name in objects.

But the job tab is not visible in users account. I gave the tab permissions for the profile which i had i assigned to the user. how can i share the job object and how can i see the shared record in user's account. Please help me for solving these.

 

 

Thanks,

eesha.

aruna11.3081223889641084E12aruna11.3081223889641084E12

Hi Eesha,

 

Job__share object will not be visible from profile settings.

It can be accessed only through Apex class or we can query it through SOQL.

To share the job record, give p[ermissions to the profile's job object.

Go to the job page layout, edit it, add sharing button to the layout.

 

If you have activated sharing ob job object, on click of this "Sharing" button, you will be able to share this perticular job record to the users or roles in your org.

 

Hope this helps.