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
NMackeyNMackey 

URLFOR and RetUrl

I've got a VF page that displays data from a few custom sObjects and have command buttons to create new objects using the following code.

 

 

<apex:commandButton action="{!URLFor($Action.Currency_Pair__c.New)}" value="New Currency Pair" />

 The problem with this code is it automatically generated a RetUrl paramater bringing users back to the VF page without showing them the saved record as is default behavior in the Salesforce UI. 

 

How do can I specify no RetUrl here?

 

 

bob_buzzardbob_buzzard

I don't think there's a simple answer to this unfortunately.  I tend to use the actual URL for creation (which can change between sandbox and production, in which case I store it in a custom setting) or execute a javascript function when the button is clicked that removes the returl parameter.  

NMackeyNMackey

That's disappointing. I really like URLFOR although it's quite poorly documented.

 

What I was originally doing was getting the required new URL via an sObject describe call so I'll have to revert to that solution. It just adds more overhead and another workaround!

 

I can't harcode URLs in a custom setting unfortunately, the app I'm working on is going to be available as a managed package on AppExchange.