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
MMA_FORCEMMA_FORCE 

Ampersand in Contact Name messing my code up???

Hi I am overriden a new button using Apex Code and VF for redirect...

When the name in the contact is :

FirstName = Me & Marry

LastName = Yo

Total Name = Me & Marry Yo

 

My code works when it is Me Yo

My code ends when it is Me & Marry Yo?

 

redirectUrl = '/006/e?CF00N70000002RNNE='+c.name+'&nooverride=1';

 Any Suggestions I also tried:

 

redirectUrl = '/006/e?CF00N70000002RNNE='+c.firstname+'+'+c.lastname+'&nooverride=1';

 Did not work...

Thanks

 

 

 

XactiumBenXactiumBen

Try doing this:

 

redirectUrl = '/006/e?CF00N70000002RNNE=' + EncodingUtil.urlEncode(c.name, 'UTF-8');

 

EncodingUtil.urlEncode should encode all of your illegal url characters (like ampersand and equals) into their url safe equivalents.

mmaxtrammaxtra

Thank you and happy Holidays ...

That passes the ampersand issue but in the lookup related list where it fills in the field i get the error on the opportunity as:

Error: No matches found.

 

When I hit the magnifying glass I do not see a difference in the value and it does bring up the same value that is in the field...

Yo & Me

 

 So I do not know if this is a salesforce.com bug or is there a way to correct this?

Thank you

XactiumBenXactiumBen

I think I remember having to pass in the id of the record for lookup fields.  Try adding this to your current url:

 

'CF00N70000002RNNE_lkid=' + c.Id

 

Message Edited by XactiumBen on 12-23-2009 11:58 PM