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

BUG? Detail Button Javascript execution affected by placement in page layout??

Hello all, this is a tough one for me to explain, but i am baffled :
We have a detail button on the Leads object which has javascript code that converts the Lead into an Account/Contact and proceeds to automatically send an email using the sendemail() function.
This was working wonderfully for a long time until this week when users suddenly said the button "wasn't working"
In fact, the code was still converting the Lead however when it got to the sendemail() call, it returned an error:
"sforce.connector.sendEmail() is not a function"
The code under this button has not changed, nor has anyone's permissions.  My first thought was that something changed with the API that meant these users needed some additional permission.   I tried nearly every combination of profiles and permissions and could not get it to work.  Randomly, I moved a user to a new page layout with the button on it and suddenly it worked as normal again.
After further testing, I found that if I simply moved the button in the page layout (there are other custom buttons), it would work.  if I moved it back to its original location, it would fail with the exact same error.
Does anyone have any logical explanation for this?  I am stumped, and would like to know what to do to prevent this in the future.
many thanks
Hello gireeshz,

I'm not sure what would cause this but you may want to start with a debug tool to see if there is an error. The Firebug add-on for FireFox works really well for finding errors in code to see what might be causing the issue. You can download it from the FireFox site.
Thanks Chris. I'll give that a shot and see what it turns up.