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
pdopdo 

Passing Parameters in a URLFOR

Hi All,

My problem is that I am trying to pre-populate fields in a Visualforce page (Case) when clicking on an output link from another page (Opportunity).

 

Output Link

<apex:page standardController="Opportunity">
    <apex:outputLink value="{!urlfor($Page.wfcallcase, null, [account=opportunity.account.name])}" target="_top">
    Request Workflow Call
    </apex:outputLink>
</apex:page>

 Visualforce Page

<apex:page standardController="Case" sidebar="false" showheader="false">
    
    <script language="JavaScript" type="text/javascript">
    function CloseAndRefresh()
    {
        window.opener.location.href="/{!case.opportunity__r.id}";
        window.top.close();
          
    }
    </script>
    
    <apex:sectionHeader subtitle="New Workflow Call Request" title="Workflow Call Case Edit" />
    <apex:form >
        <apex:pageBlock title="Request a Workflow Call" >
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}" oncomplete="CloseAndRefresh()" />
                <apex:commandButton value="Cancel" onclick="CloseAndRefresh()" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection columns="2">
                <apex:inputField id="owner" value="{!case.ownerid}"/>
                <apex:inputField id="origin" value="{!case.origin}" />
                <apex:inputField id="account" value="{!case.accountid}" />
                <apex:inputField id="component" value="{!case.Component__c}" />
                <apex:inputField id="contact" value="{!case.contactid}" />
                <apex:inputField id="priority" value="{!case.priority}" />
                <apex:inputField id="subject" value="{!case.subject}" />
                <apex:inputField id="level" value="{!case.Level__c}" />
                <apex:inputField id="status" value="{!case.status}" />
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1" >
                <apex:inputField id="description" value="{!case.description}" />
                <apex:inputField id="obstacle" value="{!case.Obstacles__c}" />
                <apex:inputField id="expectation" value="{!case.Integration_Expectations__c}" />
                <apex:inputField id="plan" value="{!case.Implementation_Plan__c}" />
                <apex:inputField id="date" value="{!case.Scheduled_Contact_Date__c}" />
                <apex:inputField id="time" value="{!case.Time_Info__c}" />
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="2" >
                <apex:inputField id="interface" value="{!case.Interfaces_Team__c}" />
                <apex:outputField id="recordtype" value="{!case.recordtypeid}" />
                <apex:outputField id="opportunity" value="{!case.Opportunity__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I am trying to pass the Account Name to the page, but the field is blank.  Can anyone help? 

Abhay AroraAbhay Arora

There are 2 parameters you need to pass for thsi

 

cas4_lkid and cas4_mod pass name of account in one and Id of account in second and this will solve your issue

pdopdo

Hi Abhay,

Thanks for the response.  I tried you suggestion, but this did not work.  Also, since I changed the ID of the field on the page, shouldn't I be able to just do the following?  Again, tried both your suggested approach and mine, but it did not work.  Any other suggestions?

 

<apex:page standardController="Opportunity">
    <apex:outputLink value="{!urlfor($Page.wfcallcase, null, [account_lkid=opportunity.account, account_mod=opportunity.account.name])}" target="_top">
    Request Workflow Call
    </apex:outputLink>
</apex:page>

 

Abhay AroraAbhay Arora

Can you just check what exact the ID of that field comes when you check with firebug

 

right click on field and check the ID

 

Or just try with $Component.account=value you want to pass also do check the field you are trying to send is not null