Activity › Forums › Salesforce® Discussions › How immediate attribute work on CommandLinks and CommandButtons in Salesforce?

  • madhulika shah

    Member
    August 20, 2018 at 9:03 AM

    Hi Parul,

    By setting immediate to true, validation rules are skipped and the action associated with the CommandLinks and CommandButtons is executed immediately.

    You can write it like this:

    <apex:CommandLink action="{!cancelApplication}" value="Cancel" styleClass="btn" id="btnCancel" immediate="true">

  • [adinserter block='9']
  • shariq

    Member
    September 16, 2018 at 12:56 PM

    Hi,

    Visualforce Immediate Attribute on CommandLinks and CommandButtons Technical Explanation :-

    • When we don’t want the validation rule to be fire during server request we set this attribute Immediate=”true”.
    • Default value of this immediate attribute is false.
    • When we are having functionality of Back to previous page or cancel button, where we don’t our validation rules to be fired. In this case if we didn’t set Immediate=”true” where validation rule will get fired and we end up in a state of unable to return to previous page.To avoid this case we need to set Immediate=”true” like below Visualforce Immediate Attribute on CommandLinks and CommandButtons example.

    <apex:CommandLink action="{!cancelMethod}" value="Cancel Link" styleClass="btn" id="btnCancel" immediate="true">

    <apex:commandButton value="Cancel" immediate="true" action="{!cancelbutton}"/>

    • We usually wire this attribute in cancel button to skip validation rules.

    Hope this helps.

Log In to reply.

Popular Salesforce Blogs

Steps to Connect Pardot to Salesforce

Steps to Connect Pardot to Salesforce

Blog in

Steps to Integrate Salesforce and Pardot: There are some steps to install Pardot in salesforce 1- Click on this link https://login.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t1W000000U7P8(production) https://test.salesforce.com/?ec=302&startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04t1W000000U7P8 (sandbox) 2- After…

Popular Salesforce Videos