+ Start a Discussion
j.themussj.themuss 

Can't see Contact Data in http://the1200.force.com/the1200

Hi Guys

 

I am new to force.com sites and have been working through the force.com tutorials.

 

I have created some custom fields on the standard Contact object.

 

I then wanted to display a list of contacts from the standard contact object on the website http://the1200.force.com/the1200

 

When I preview the Visualforce page inside SF it all works perfectly and lists my contacts..

But once I try to see it on the web page all I get are the table headers and no data...

 

The site is active.

 

Does anyone have any clues as to why the data does not display.

 

Am I allowed to display standard objects like Contacts via the web site http://the1200.force.com/the1200 ?

 

Regards

 

j.themuss

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Have you marked the static resource as public?

All Answers

bob_buzzardbob_buzzard

You are allowed to access contacts on Force.com sites.  

 

Is your page using a standard controller or a custom controller?  If the former, it will respect sharing rules and only show contacts that are owned by the public access user.

 

Also, have you given access to the various contact fields via the public access profile?

j.themussj.themuss

Hi Bob

 

Thanks for the reply... I tried to include some screen shots below but the option is not available...

 

I am a little confused... I thought Force.com sites would allow me to display that information on a public website or anyone to see.

So based on that how could any of those people ever have created those records?

 

I see a complete table with all contacts listed when I click the preview link within Develop, Sites..

 

 

I have also set the Public Access Settings as follows for the standard contact object

 

 

All the Contact fields are marked as visible also...

 

But when I type the web address directly into a browser I get a blank page except for the headings..

The CSS does not seem to be set either?

 

 Any ideas where I have gone wrong?

 

Regards

 

j.themuss

bob_buzzardbob_buzzard

If you use a custom controller, you can bypass the sharing settings.  Just declare your class 'without sharing'.

j.themussj.themuss

Hi Bob..

 

I am using the standard controller, and am early in the learning curve so doing custom controllers is beyond me at this point in time.

 

Is there no was to flag that people who are non salesforce users can browse to that web page and view the data in the tbale list.

 

What I am doing is chapter 9 and chapter 10 in the force.com workbook from the developer.force.com website...

 

I just cannot see what I have done wrong to prevent the data from showing...

 

I actually went back and created a custom object to see if that would make a difference but the result is the same...

 

Regards

bob_buzzardbob_buzzard

If you use a custom object you'll need to ensure you make that object available via the public access profile, and that you set the org-wide defaults to public.  Otherwise the standard controller will not provide access to them.

 

The same applies to contacts - if the sharing is private, then that means only the owner and system administrator can access the records.

j.themussj.themuss

Hi Bob..

 

Just checked the OWDs and for Contacts it is set to Public Read/Write, but still all I see are the Headers when I try to view the page at http://the1200.force.com/the1200.

 

Bob, if you browse to that webaddress above, do you see anything different to the headers?

 

Absolutely stumped and confused with this as I folowed the workbook to the letter and don't know why it does not work.

 

Any other ideas as to what I could try?

 

bob_buzzardbob_buzzard

I see the same as you.  Can you post your page code/markup?

j.themussj.themuss

Hi Bob...

 

Here is the markup..

 

<apex:page standardStylesheets="false" ShowHeader="false" sidebar="false" standardController="Contact" recordSetVar="soldiers">
<apex:stylesheet value="{!URLFOR($Resource.Styles, 'styles.css')}"/>
<!-- Begin Default Content REMOVE THIS -->
<h1>The 1200 - WWI Soldiers of The Southern Highlands</h1>
<apex:form >
<apex:dataTable value="{!Soldiers}" var="indsoldier" rowClasses="odd,even">
<apex:column headerValue="Soldier">
<apex:outputText value="{!indsoldier.name}"/>
</apex:column>

<apex:column headerValue="Birthplace">
<apex:outputText value="{!indsoldier.Birth_Place__c}"/>
</apex:column>

<apex:column headerValue="Australian War Memorial Service Record Link">

<a href="url">
<apex:outputText value="{!indsoldier.Australian_War_Memorial_Service_Record__c}"/>
</a>
</apex:column>

</apex:dataTable>
</apex:form>
<!-- End Default Content REMOVE THIS -->
</apex:page>

bob_buzzardbob_buzzard

There's something specific to contacts here which is eluding me.  I've recreated your page on my site and when I use the Contact standard controller I can't get any information out, but when I use one of my custom objects it works fine.  This is in keeping with the force.com workbook, where the examples are for custom objects.

 

I suspect its to do with the license type for the guest user, as sites users should only be able to see the account and contact that they are related to.  I can't find anywhere that its written down though.

 

Therefore, if you can move your data to a custom object you should be good to go.

j.themussj.themuss

Thanks Bob..

 

I did try that earlier without any joy... but will start again with a custom object and see how I go

 

Thanks for all the input

 

 

bob_buzzardbob_buzzard

As long as the object is public and your site profile has access to it you should be okay.  Post back if you hit problems and I'll compare my setup with yours.

j.themussj.themuss

Hi Bob..

 

Have tried that with a custom object but I get the same problem

 

I have set the public access settings and also the owds... but no joy..

 

Very frustrating I must say..

 

Any ideas or other settings that I may be missing..

 

I think I have the Enterprise Edition...  How do I confirm that?

 

j,themuss

bob_buzzardbob_buzzard

My setup is as follows:

 

(1) The custom object is deployed

(2) Guest user profile for the site has read access to the custom object and access to all fields in the object (via Public Access Settings).

(3) OWD for the custom object is 'Public Read/Write'

 

That's all I've had to do.  I've just created a test object, added one record and now I can see it straight away.

j.themussj.themuss

Hi Bob..

 

Thanks again for your input..

 

But again even though all items are set... I get no joy..

 

I have gone into the fields for the custom object and set them all to visible.

I have Read,Create,Edit, Delete on the Object

The Object is deployed...

And the OWD settings for the object are public/read/write

 

I am absolutely going out of my mind with frustration on this...

 

j.themuss

bob_buzzardbob_buzzard

This is very strange.

 

If you turn on debug logging for the site guest user and access the page, what output do you see - I get the following:

 

25.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
15:04:42.027 (27447000)|EXECUTION_STARTED
15:04:42.027 (27512000)|CODE_UNIT_STARTED|[EXTERNAL]|06680000000TqXw|VF: /apex/KAB_TUTORIAL__sitecontacts
15:04:42.054 (54674000)|VF_SERIALIZE_VIEWSTATE_BEGIN|06680000000TqXw
15:04:42.056 (56218000)|VF_SERIALIZE_VIEWSTATE_END
15:04:42.525 (61324000)|CUMULATIVE_LIMIT_USAGE
15:04:42.525|LIMIT_USAGE_FOR_NS|KAB_TUTORIAL|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 1 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of code statements: 0 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

15:04:42.525|CUMULATIVE_LIMIT_USAGE_END

15:04:42.061 (61368000)|CODE_UNIT_FINISHED|VF: /apex/KAB_TUTORIAL__sitecontacts
15:04:42.061 (61378000)|EXECUTION_FINISHED

 which shows that the controller is able to access the single object that I've created.

j.themussj.themuss

Hi Bob..

 

Success!!!

 

The Markup was still referencing the standard Contact object...

 

Once I changed it there.. I get the data in the web page..

 

So frustrating... but I guess I will never let that happen again..

 

Thanks again for all of your help..

 

Regards

 

j.themuss

j.themussj.themuss

Hi Bob...

 

Did you get the proper CSS styling to show on the external website?

 

Looks OK within SF but once outside it is plain text with no formatting...

 

Cheers

 

j.themuss

bob_buzzardbob_buzzard

Have you marked the static resource as public?

This was selected as the best answer
j.themussj.themuss

Bob.. you are indeed The Man!

 

Thanks for that... 

 

I guess its easy when you know how :)

 

I owe you a Guinness!

 

j.themuss

bob_buzzardbob_buzzard
I'll take you up on that if our paths ever cross.