Salesforce
We can directly open Custom buttons on objects in visualforce page by using URLFor attribute . by the help of URLFor attribute we can reuse Custom button of type url in our visualforce page . Steps need to be follow.
  1. Create a custom button of type url by selecting button and links options on custom and standard object .
  2. Now in you visulaforce page you can directly use your cusotm button by using URLFor Attribute here is the syntax.
<apex:page standardController="Contact" >
  <apex:pageBlock >
    <apex:sectionHeader title="URLFor Example" />
    <apex:form >
   <apex:commandButton action="{!URLFOR($Action.Contact.TestButton,RecordId)}"  value="URLFor Example"/> 
   </apex:form>
</apex:pageBlock>
</apex:page>
We create a action button on contact object with name TestButton . now by using urlfor you can use it directly in your visualforce page . you can also pass recordid if needed in second attribute. NOTE : We Cannot call lightining action by using URLFOR

Hits: 283

By Himanshu Rana

My Name is Himanshu Rana, 23 Years young, born and grow up in Ghaziabad, India. A High Spirited Salesforce Admin, Developer and a Blogger. I currently work at Wakencode Technologies,

Leave a Reply

Your email address will not be published. Required fields are marked *