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
Nikvm257Nikvm257 

URL no loger exist

Hello Gurus,

 

I am a beginner in SFDC.

I am trying to build a simpleprogram  with APEX and vforce

Having attched GUI.

 

The program will have an inputt where user will enter account name

 

Press on Search button. Then a list will be displayed with a account details.(this is done using APEX + SOQL + exten to std contoler )

 

When user will cliclk on Go link it should take him to account dispaly page (I am stuck here)

 

I have written below code

 

<apex:page standardController="Account" extensions="FirstExtClass" >

<apex:form id="MyForm">
    <apex:pageBlock title="Search Criteria">
        <apex:pageBlockSection columns="1">
            <apex:outputText value="Account Name"/>
            <apex:inputText value="{!acctName}"/>
        </apex:pageBlockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Search" action="{!dosearch}" reRender="SearchResult, acctDetails, errors" />
        </apex:pageBlockButtons>
    </apex:pageBlock>

    <apex:pageBlock id="SearchResult" title="Search Results" >
        <apex:messages id="errors"/>

        <apex:pageBlockTable value="{!SearchResult}" var="acct" >
            <apex:column value="{!acct.Name}">
                <apex:facet name="header">Account Name</apex:facet>
            </apex:column>

            <apex:column value="{!acct.id}">
                <apex:facet name="header">Id </apex:facet>
            </apex:column>

            <apex:column >  
                <apex:facet name="header">Action </apex:facet>    
                <apex:outputLink value="na12.salesforce.com/">   
                Go           
                <apex:param name="id" value="{!acct.id}"/>
                </apex:outputLink>
            </apex:column>
        </apex:pageBlockTable>

    </apex:pageBlock>

</apex:form>

</apex:page>

 

 

but when I press on Go button I get ERROR URL no loger exist.

Pleae guid me!

Thanks in advance

 

-Nikhil

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

try this:

 

<apex:outputLink value="/{!acct.Id}"> GO </apex:outputLink> or <a href="/{!acct.Id}>GO</a>

 

See, in Salesforce, you can directly access any record in the system directly via the relative url "/XXXXXXXXX".

 

Inside Salesforce, you don't need to put the full URL. You can just use the relative URL.

 

Cheers.

All Answers

Cory CowgillCory Cowgill

try this:

 

<apex:outputLink value="/{!acct.Id}"> GO </apex:outputLink> or <a href="/{!acct.Id}>GO</a>

 

See, in Salesforce, you can directly access any record in the system directly via the relative url "/XXXXXXXXX".

 

Inside Salesforce, you don't need to put the full URL. You can just use the relative URL.

 

Cheers.

This was selected as the best answer
Nikvm257Nikvm257

Hey Cory ,

 

You are the best!!

 

The solution given by you really worked.

this is what I like about Salesforce communiity we help each other and grow together.

 

Thanks a lot

-Nikhil