• Phill Kemp
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies

Hi,
I'm using Salesforce professional eddition and i'm hopeing to create a onclick button on my oppertunities layout which will direct me to a visual force page/url based on a field on the current oppertunities.

I had a quick look and there was a option under behaviour to select the visual force page, however this does not allow a if or case statement to navigate to the right visual force page based on a field/value.

After searching online i found some javascript code which had worked for someone else, however it does not appear to work for me and im wondering i'm making a school boy error.

The code is (field name's and visual force page name subsituted to example and examplefield)

var event = '{!EXAMPLEFIELD}';
if(event.length == 0){
     alert("No VisualForce page Exists, please contact your administrator");
}
else{

     window.location.href='/apex/EXAMPLE'
}
I was getting a error returned of "invalid token >"

I guess my question is where am i going wrong? Do i need to enable or call javascript librarys before my code? is this a limitation of my version of salesforce, or more likely a limitation of my knowlege?

Help would be very much appreciated.

Thanks
Phill

Hi,
I'm using Salesforce professional eddition and i'm hopeing to create a onclick button on my oppertunities layout which will direct me to a visual force page/url based on a field on the current oppertunities.

I had a quick look and there was a option under behaviour to select the visual force page, however this does not allow a if or case statement to navigate to the right visual force page based on a field/value.

After searching online i found some javascript code which had worked for someone else, however it does not appear to work for me and im wondering i'm making a school boy error.

The code is (field name's and visual force page name subsituted to example and examplefield)

var event = '{!EXAMPLEFIELD}';
if(event.length == 0){
     alert("No VisualForce page Exists, please contact your administrator");
}
else{

     window.location.href='/apex/EXAMPLE'
}
I was getting a error returned of "invalid token >"

I guess my question is where am i going wrong? Do i need to enable or call javascript librarys before my code? is this a limitation of my version of salesforce, or more likely a limitation of my knowlege?

Help would be very much appreciated.

Thanks
Phill