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
murdocmurdoc 

Onclick Java Sharing Rules

I have a custom link that executes a java script, the link takes you to a finance database. All the code seems to work fine, but the problem is we need only users who have access to the records (heirarchy) to have access to the link. Is there a way to add sharing rules to the coded link? Is there another way this can be accomplished?

Best Answer chosen by Admin (Salesforce Developers) 
Satish_SFDCSatish_SFDC
In that case, i guess custom link cannot solve this issue.

What i was thinking was around the lines of inline visual force page with a link.
You create a visualforce page with the link and make it visible (by using rendered property) only to users with edit permissions. Which means you check for permissions in the VF page.

You then embed this visualforce page in the opportunity page.
I have not tried this but i think it should work.

Regards,
Satish Kumar

All Answers

Satish_SFDCSatish_SFDC
What is the OWD setting. If it is private, users who do not have access to the record will not be able to see the record itself. So if there is no access to the record they will not see the record or the custom link.

Regards,
Satish Kumar
murdocmurdoc

Thanks. It's open. We're just using the heirarchy. So, Opportunity owners and Opportunity Team members can edit opportunities. Everyone can read. So, we only want Opportunity Owners and Team members to see the data generated by the link.

Satish_SFDCSatish_SFDC
In that case, i guess custom link cannot solve this issue.

What i was thinking was around the lines of inline visual force page with a link.
You create a visualforce page with the link and make it visible (by using rendered property) only to users with edit permissions. Which means you check for permissions in the VF page.

You then embed this visualforce page in the opportunity page.
I have not tried this but i think it should work.

Regards,
Satish Kumar
This was selected as the best answer
murdocmurdoc

Thanks! I was actually thinking along the same lines. I will give this a shot now. I'll let you know if it works. If it does I will check as best answer. Thanks.

murdocmurdoc

This worked, thanks!