4

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.

4 Answers 4

3

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

2
  • My worst fears comes true :( I was banging my head over this for 2 days and now its not even possible. Its good to know that we can copy this to a wrapper object but the whole deal of storing redundant information is the bad part. I wonder why Salesforce puts these limitations on Standard objects.
    – Richard N
    Commented Nov 20, 2012 at 18:01
  • Thanks for the link. I guess I will have to do something similar.
    – Richard N
    Commented Nov 20, 2012 at 18:06
2

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.

1

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:

  1. Use debug logging to check if query for Contracts actually returns something on the Portal page.
  2. If it does - construct a helper ContractWrapper class which would hold Strings, Ids, Date fields etc. You need to stupidly painstakingly copy over the values from fields, simple member variable Contract won't work.
  3. 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.

2
  • Yes I will be trying this out over the weekend. But I have some security frame work in place using the sharing settings which are available with the High volume customer portal user licenses. So right the Contract object is not available to be configured under this sharing model.
    – Richard N
    Commented Nov 21, 2012 at 21:28
  • 1
    You could still try to query the info how the sharing you've set up is reflected in AccountShare, ContractShare etc. tables. salesforce.stackexchange.com/questions/4621/… should be a nice start. Still sounds painful though. If it's just for simple displaying of data - try this wrapper trick. If you plan to expose some reports or build significant chunk of functionality - helper object might be indeed best :/
    – eyescream
    Commented Nov 21, 2012 at 23:29
0

Contracts are available in Customer Community license now https://help.salesforce.com/s/articleView?id=sf.users_license_types_communities.htm&type=5

Just putting it here incase someone else lands on this question like I did.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .