Running blog post of VF examples for URLFOR that aren’t so obvious. More of an aide-memoire to myself
Clone button
<!-- Note use of URL param clone='1' --> <apex:commandButton value="Clone" action="{!URLFOR($Action.Foo__c.edit, Foo__c.id, [clone='1'])}" id="clonebtn"/>
Custom Controller – Cancel button – avoid coding a custom Cancel action method
<!-- Goes to value of current page's RetURL parameter if any; if none goes to home page --> <apex:commandButton value="Cancel" action="{!URLFOR('/' & $CurrentPage.parameters.retURL)}"/>
Fixed domain name plus merge fields
<!-- Goes to some rest resource on known domain; note use of SFDC formula expression to concatenate--> <apex:commandButton value="Foo" action="{!URLFOR('https://www.foo.com/' & someControllerProperty)}"/>