3

I want to execute this Javascript from the HYPERLINK function in my image formula field. This way I can display an image in a certain circumstance (using IF) and then do something via the Javascript by passing it info from the record.

e.g., IF(Field='A',HYPERLINK('Javascript',IMAGE(ImageLocation,'ImageName')'Name'),'')

My problem is that I am taking Javascript from an existing button and placing it into the HYPERLINK function, and I don't know how to construct the syntax so that it works.

Button: Execute Javascript OnClick Javascript:

> var child = window.open("/apex/DoSomething?cid={!Contact.Id}", "Title", "height=400,width=850, scrollbars =yes"); 

>var timer = setInterval(checkChild, 250); 

>function checkChild() { 
if (child.closed) { 
clearInterval(timer); 
location.reload(true); 
>
} 

>}
2

Please try below link:
https://sfdc-gyaan.rhcloud.com/2014/04/referencing-javascript-file-from-static-resources-in-formula-fields/

It looks like you are trying to reload the parent page from popup. That can we achieved using javascript in popup window.

Below function will help you to close popup window and reload parent window.

 function closeWindow(){      
            window.opener.location.href="/{!$CurrentPage.parameters.cid}";
            window.top.close();
      }

Please make sure that developer mode is disabled. If developer mode is not disabled, parent window will not reload

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.