I have a customer portal where we expose different types of records to users who need to see only records that belong to the same Account as theirs. The portal is built using Visualforce pages and a Force.com site completely overriding the native portal.
As of now I am achieving this using profiles and sharing settings that come with high volume customer portal user licenses.
I will also need to display CONTRACT (standard object) records to users authorized to see them. When I try to assign security to Contracts, I see its not directly possible. I saw that the Account object security page lists Contracts at the field level. My user's profile has access to this.
Now I am trying to display a link conditionally using the code:
<apex:variable var="contact_var" rendered="{!$ObjectType.Contract.accessible}" value="Contract">
<li><a href="#" id="contractsnav">CONTRACTS</a></li>
</apex:variable>
But this link does not appear which means that the user does not have access to CONTRACTS. What am I missing here? Can we display CONTRACT records in a customer portal? And what needs to be done so that portal users can see those records.
Thank you.
Attribution to: Richard N
Possible Suggestion/Solution #1
Unfortunately Contracts are not accessible through Customer Portal. You can create a second, custom, object and essentially persist duplicate information of the Contract to this custom object. By creating essentially a duplicate object type, you can expose that object type to the customer portal. Here is a blog post regarding it.
http://techblog.appirio.com/2008/10/michael-mclaughlin-overcoming-customer.html
Attribution to: Michael Welburn
Possible Suggestion/Solution #2
Can you try some kind of last resort before going with @MichaelWelburn's answer...
Recently I had to create an "admin panel" for our power users that would let them submit many different batch jobs (less work for IT). I wanted to display status of past jobs (data from AsyncApexJob
table). For the life of me I couldn't get it to work, page was throwing "insufficient privileges" when I was logged in as non-SysAdmin user. Even though profile had rights to both page and controller.
Long story short:
- Use debug logging to check if query for Contracts actually returns something on the Portal page.
- If it does - construct a helper
ContractWrapper
class which would hold Strings, Ids, Date fields etc. You need tostupidlypainstakingly copy over the values from fields, simple member variableContract
won't work. - Create a list of these and SF should allow you to display it in
<apex:dataTable />
etc. like any other query result.
It's a tiny ray of hope and I have no idea if it won't be closed up in future... but it worked for me so maybe can work on the Portal too.
Attribution to: eyescream
Possible Suggestion/Solution #3
You can turn on Entitlement Management Setup --> Customize --> Entitlement Management
.
This will allow you to use "Service Contracts" which can be accessed from the Customer Portal.
They are very similar to Contracts, but allow you to associate entitlements and enforce SLAs.
Attribution to: Sami Ellong
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4613