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

scontrol to does not like apostophes in Account name and other mysteries - what is wrong?

I built an sControl that operates my New Sales Opp button to create new opportunities and prepopulate fields from the Account Table into the Opportunity. It works great except when the name of the Account has an apostrophe in the name, such as People's Credit Union. Then it just goes to a blank page.

My workaround has been to take out the apostrophe in the account name.


However, there are a few other accounts where I cannot figure out why it does not work - all I get is a blank page. There is no punctuation in the name or anything I can see that would cause it not to work.

Please help!


Here is my code:


<script language="javascript">

function redirect()
var redirectString = '/006/e?retURL=%2F001%2Fo






















One suggestion would be to use Firefox and the Firebug debugger for testing.  It will show you what the code looked like when the script runs, you might be able to see the error.

I had a similar situation, and ended up executing a query for the Account data, and then using the encodeURIComponent function against the result elements so they could be passed as parameters.

You might consider updating this to a Visualforce page and controller instead, and then you won't have the URL related issues.

Moved to the Scontrol board.

It's because you're using apostrophes as the string delimiters, like


'my url here'


So JS sees the apostrophe in the {!Account.Name} merge field and thinks that's the end of the string, and so you are generating a partial URL.


Try using double quotes instead, like


"my url here"