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
Markey1Markey1 

Set Record Type Via Link? Dynamic Links?

I have two questions that should be pretty simple although I have spent good time trying to find the solution.

 

First: On my site I have a component acting as my sidebar with a set of links. When one of the links is clicked, I want it to dynamically set the record type. For example, if the user clicks the enrollment link, it would take them to the enrollment page, but I also want the record type to be set to "enrollment". Via the UI you can set record type via the URL but I do not know how to accomplish this via Sites.

 

<apex:component >
  <div id = "menu_container">
    <div id = "menu">
      <ul>
        <li class="menu_header">Some Name
          <ul>
            <li><a href="http://testing.somename.cs3.force.com/enroll">Enrollment</a></li>
            <li><a href="http://testing.somename.cs3.force.com/cert">Certification</a></li>
          </ul>
        </li>                            
      </ul>
    </div>
  </div>
</apex:component>

 

Second: I'm sure there is a better way of linking to pages vs. the static example above. I want to avoid scanning through the site if I change the name of a Page. Is there a better way of referencing a Page via a link?

 

Any assistance with code, ideas, and/or examples is much appreciated.

RyanGuestRyanGuest

For the second part of your question:

 

Have a look at using $Page and URLFOR (http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html)

 

You should be able to use URLFOR in an apex:outputLink along with $Page.MyPageName.

Markey1Markey1

Thanks Ryan, that fixes #2. This is what worked for me:

 

<li><apex:outputlink value="{!URLFOR($Page.yourpage)}">Your Name</apex:outputlink></li>

 

Anyone have an idea on question #1?