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
Chris LamChris Lam 

Using the Apex page - List contacts to update the contact field in the case

Hi,

I have created a custom button in the case which opens up a visual force page to list all contacts in the account of the current case.  Is there a way to change these contact name into a link whereby on clicking, I can change the case contact?

My Visual Force Page:

<apex:page standardController="account" showHeader="false" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{! account.contacts}" var="item">
    <apex:column value="{! item.name}"/>
    <apex:column value="{! item.email}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Screen shot for my list contact button as below:

User-added image

Cheers,
Chris
Puru AnnamalaiPuru Annamalai
Hi Chris,

Try the below approach,

Change the Statement

FROM

<apex:column value="{! item.name}"/>

TO

<apex:column headerValue="Name">
<apex:outputLink value="/{!item.id}" id="theLink" target="_blank">{!item.name}</apex:outputLink>
</apex:column>
Chris LamChris Lam
Hi Puru,

Thank you for the suggestion, I updated to the below but when I click on either the contact name or email address, the browser opens a new tab with "This Page can't be displayed" while using the Salesforce Service Cloud console.

<apex:page standardController="account" showHeader="false" sidebar="false">
<apex:pageBlock >
<apex:pageBlockTable value="{! account.contacts}" var="item">
    <apex:column headerValue="Name">
        <apex:outputLink value="/console?tsid={!item.id}" id="theLink" target="_blank">{! item.name}</apex:outputLink>
    </apex:column>
    <apex:column headerValue="Email Address">
        <apex:outputLink value="/{item.id}" id="theLink2" target="_blank">{! item.email}</apex:outputLink>
    </apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

The URL for the pages that opens a new tab are:
When contact name is clicked:
javascript:srcUp('https%3A%2F%2Ftest.salesforce.com%2Fconsole%3Ftsid%3D003O000000eV5P1IAK%26isdtp%3Dvw');

When Email Address is clicked:
javascript:srcUp('https%3A%2F%2Fcs5.salesforce.com%2F%7Bitem.id%7D%3Fisdtp%3Dvw');

I have added Salesforce test URL into the white list domain but still having the same issue.

Kind regards,
Chris