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
djfubardjfubar 

URLFOR issue

Hi,

 

I have a custom button on the account page which executes some javascript and redirects to another website.

 

On return I want it to return to a specific opportunity. I can return to the account record without any issues (see below):-

 

window.location.href = 'http://www.google.com&retURL={!URLENCODE('https://cs1.salesforce.com' + URLFOR($Action.Account.View, Account.Id))}

 

But when I change the Action to Opportunity I recieve "Invlaid parameter for function URLFOR" (code for this is below)

 

window.location.href = 'http://www.google.com&retURL={!URLENCODE('https://cs1.salesforce.com' + URLFOR($Action.Opportunity.View, Account.OppID__c))}

 

Is it not possible to use the URLFOR function for this scenario?

 

Any help would be great!!

 

Thanks

Pete

MrTheTylerMrTheTyler

If you have defined a relationship between the account and opportunity objects you can use the relationship name like so: Account.OppID__r

 

~Tyler

djfubardjfubar

Hi,

 

It still wont let me use $Action.Opportunity.View on the account record?

 

I get "Invlaid parameter for function URLFOR" ???

 

window.location.href = 'http://www.google.com&retURL={!URLENCODE('https://cs1.salesforce.com' + URLFOR($Action.Opportunity.View, Account.OppID__r))}

 

Thanks