• khvp
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

How can I access the $Site global variables from within apex? Specifically I want the $SIte.OriginalURL value.

 

Thanks.

 

  • June 18, 2010
  • Like
  • 0

I am probably missing something simple here, but I am not quite sure how to find the solution.

 

I've got a site set up with four visualforce pages added:

 

First the landing page with some static links for testing, this is set to the Site Home Page

 

 

<apex:page showHeader="false" sidebar="false">
<div>Page One

<a href="/01t60000000dBhz">Product View</a>

<a href="/a0ZR0000001wIjV">ECO View</a>
</div>
</apex:page>


 

 

Next I have a List View of my custom object, which has a Lookup Relationship to Product2

 

<apex:page standardController="ECO__c"  sidebar="false" showHeader="false" >
<apex:sectionHeader title="Engineering Change Order: ECO Details" />
<apex:PageMessages />
<apex:messages />
<apex:listViews type="ECO__c" />
</apex:page>

 

 A page to view the details of my custom object: ECO__c

<apex:page standardController="ECO__c" sidebar="false" showHeader="false">
<apex:sectionHeader title="Engineering Change Order" />
<apex:PageMessages />
<apex:messages />

<apex:detail relatedList="true" />
</apex:page>

 

 Finally, a custom page to view the Product details

 

 

<apex:page standardController="Product2"  sidebar="false" showHeader="false">
<apex:sectionHeader title="Engineering Change Order: Product Details" />
<apex:PageMessages />
<apex:messages />
<apex:detail relatedList="false" />
</apex:page>

 

 

Under my Site Security I've checked Read access for Products, Price Books, and the custom object ECO.

 

 

Now when I access my site:

The Home Page loads fine.

My ECO LIst loads fine, the links for ECO ID and Product2 are http://mysite/<ID>

When I click the Eco View Link, my VF page for ECO Details is displayed for the appropriate record, no problem here.

When I click the View Products link, The "Site is down for Maintenance" message appears.

I can access /viewProducts?id=01t60000000dBhz directly and my custom VF Page is displayed for the Product, so it doesn't seem like a permissions issue.

 

 

How can I set my viewProducts page as the default detail view for Products for only my Site user?

 

Do I need to do something with action= to catch the ID of a standard object in the URL and then redirect to my custom page with the id= parameter?

 

 

Thank you for your assistance.

 

 

 

  • June 08, 2010
  • Like
  • 0

How can I access the $Site global variables from within apex? Specifically I want the $SIte.OriginalURL value.

 

Thanks.

 

  • June 18, 2010
  • Like
  • 0