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
jisaacjisaac 

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

&00N60000001NLgS={!Account.OSI_Client__c}

&00N60000001cIWR={!Account.RFG_Strategic_Advisor__c}

&00N30000000vIfp={!Account.Core_Data_System_Install_Type__c}

&00N60000001NvR4={!Account.FMS_Integration__c}

&00N60000001dIdw={!Account.SSG_Client__c}

&00N60000001MG9v={!Account.Raddon_Client_ID__c}

&00N30000001APP5={!Account.Core_Contract_Exp_Date__c}

&00N30000001APbW={!Account.Regional_Account_Manager__c}

&00N30000001AaDU={!Account.Client_Agreement_Numb__c}

&00N30000001Bldu={!Account.Peoplesoft_Acctg_No__c}

&00N3000000091y9={!Account.Assets__c}

&opp4={!Account.Name}

&00N30000000k5v2={!Account.Number_of_MembersCustomers__c}

&00N3000000091y8={!Account.CoreSystem__c}

&00N30000000sHGJ={!Account.Core_Account_Manager__c}

&00N60000001MS1j={!Account.Digital_Insight_Rep__c}

&00N60000001eUvJ={!Account.OSI_ACH_Invoicing_Information__c}

&RecordType=012600000004v9b';
}
parent.frames.location.replace(redirectString);
}

redirect();

//-->
</script>

JimRaeJimRae

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.

mtbclimbermtbclimber
Moved to the Scontrol board.
werewolfwerewolf

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"