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
Jay PollackJay Pollack 

Custom Case Button - Issues When Opening in Hover Related List

I've created a custom button to allow users to create a case from the Contact related list on the Account tab.  It works great when a user scrolls down and uses the related list.  But if you use the related list hover at the top, the new case opens up in the hover itself and them promptly disappears when you move away.

 

I'm looking for a way to have this work whether you are in the hover or not without having the button open in a new window.  If there any way to tell my button if it's opening up from the hover or from the bottom related list?

 

This is the button code:

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}

var records = {!GETRECORDIDS($ObjectType.Contact)}; //grabs the Contact records displayed on the search page.

var updateRecords = []; //array for holding records that this code will ultimately update

if (records[0] == null)
{ //if the button was clicked but there was no record selected
alert("Please select at least one Contact."); //alert the user that they didn't make a selection
}

else
{
//otherwise, there was a record selection

for (var a=0; a<=0; a++) { //for all records
var objContact = new sforce.SObject("Contact"); //create a new sObject for storing updated record details
objContact = records[a]; //set the Id of the selected Contact record
updateRecords.push(objContact); //add the updated record to our array

}

window.location.href= "/500/e?&def_contact_id="+updateRecords;

//window.open( "/500/e?&def_contact_id="+updateRecords,'name');


}

 

Thanks in advance for any help!

dfpittdfpitt

Jay,

 

I'm also interested in this, where you able to solve it?

Jay PollackJay Pollack

No - it still happens for some users

ANUJIT DASANUJIT DAS
Use window.open(); if you are using onClick JS, otherwise use URL type in the custom button
It solved my problem.