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
Sukhdeep Singh 1Sukhdeep Singh 1 

Need to open a popup on the click of an image present is a formula field.


Hi,
 
I am have custom link on a standard page to open a popup(VF page).
But my requirement is to open same popup through a formula field showing an image into it.
Can somebody suggest How can I achieve this.
My current custom link code is below.
 
{!REQUIRESCRIPT('/soap/ajax/26.0/connection.js')}
{!REQUIRESCRIPT('/js/functions.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/jquery-1.8.2.min.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/ui/jquery-ui-1.9.1.custom.min.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/postmessage/jquery.ba-postmessage.js')}
{!REQUIRESCRIPT('/resource/jQueryForPopup/jQuery/bbq/jquery.ba-bbq.min.js')}
{!REQUIRESCRIPT("/support/console/26.0/integration.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}
requireCssFile('/resource/jQueryForPopup/jQuery/ui/css/ui-lightness/jquery-ui-1.9.1.custom.min.css');
 
function requireCssFile(filename)
{
var fileref = document.createElement('link');
fileref.setAttribute('rel', 'stylesheet');
fileref.setAttribute('type', 'text/css');
fileref.setAttribute('href', filename);
document.getElementsByTagName('head')[0].appendChild(fileref);
}
var j$ = jQuery.noConflict();
var parent_domain = window.location.protocol + '//' + window.location.host;
var iframe_url;
if (sforce.console.isInConsole())
iframe_url = '{!URLFOR("https://cs1.salesforce.com/apex/PAInlineVF")}'+'isdtp=vw&id='+'{!Service_Request__c.Id}'+'&parent_domain='+parent_domain;
else
iframe_url = '{!URLFOR("https://cs1.salesforce.com/apex/PAInlineVF")}'+'?id='+'{!Service_Request__c.Id}'+'&parent_domain='+parent_domain;
var child_domain = iframe_url.substring(0, iframe_url.indexOf('/', 9));
var j$modalDialog = j$('<div id="opppopup"></div>')
.html('<iframe id="iframeContentId" src="' + iframe_url + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="no" />')
.dialog({
autoOpen: true,
title: 'Address Search Tool',
resizable: true,
width: 600,
height: 250,
autoResize: true,
modal: true,
draggable: true
});
 
j$modalDialog.dialog('open');
Raghu_CloudRaghu_Cloud
Hi Sukhdeep, 

You can do a formula field on a Standard page layout which returns a clickable image. The clickable image can be given any web page you want to re direct to. Find the steps below

Create a Formula field which returns text.
In the advanced formula editor, you can use standard functionalities HYPERLINK and IMAGE. 
e.g: HYPERLINK("https://google.com" , IMAGE("https://login.salesforce.com/img/logo190.png", "Clickable"))
The above example returns you a Salesforce logo for the field which on clicked directs you to google. 
You can include images which are already exisiting in the salesforce org. 
Sukhdeep Singh 1Sukhdeep Singh 1
Hi Cloud Surfer,

Thanks for your reply, Actually HYPERLINK opens a new window to show the VF page. But I need a pop window on the same standard page & after saving data this pop up window should close & refresh the parent window.
Please suggest on this.

Thanks,