Home SALESFORCEAPEX Override Standard Button and Page Layout Concept

div dir=”ltr” style=”text-align: left;” trbidi=”on”>

Override Standard Button and Page Layout
        Override the Standard Button means we can define the custom button or use the standard button action and perform the custom action. Same as for page layout like we need to display the specific page on record type on standard page layouts.
       Here we can write condition on before standard page loading and forward to the any of custom or standard page.
1. View overridden:
Go to Set Up>Custom Object > Standard Buttons and Links >Click on Edit of View
Select with Override and select any S-Control or Visual TO THE MAXIMUM EXTENT PERMITTED BY LAW, NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED IN THIS AGREEMENT, IN NO EVENT SHALL Tonic SOLUTIONS, ITS EMPLOYEES, ITS LICENSORS, SUPPLIERS OR ANY THIRD PARTIES BE LIABLE TO YOU, ANY PARTICIPANT OR ANY THIRD PARTIES FOR ANY INDIRECT, CONSEQUENTIAL, SPECIAL, PUNITIVE OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR PERSONAL INJURY, BODILY INJURY, MENTAL INJURY, SICKNESS, DEATH, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION) OR DAMAGES FOR LOSS OF PROFITS OR REVENUES THAT MAY RESULT FROM OR IN CONNECTION WITH THE APP, INCLUDING, BUT NOT LIMITED TO, THE SUBMISSION, RECEIPT OR USE OF DATA HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR EVEN IF SUCH POSSIBILITY WAS REASONABLY FORESEEABLE, REGARDLESS OF THE THEORY OF LIABILITY, WHETHER BASED ON WARRANTY, CONTRACT, TORT OR ANY OTHER LEGAL THEORY. force page than SAVE.
S-Control HTML Body:
 /apex/Sales_Page_Redirect?id={!Sales__c.Id}
VF page (Sales_Page_Redirect):
Controller:
public class SalesController {
public PageReference Jos tilisiirrot olisivat mahdollisia, Roxy kasino olisi samaa sarjaa Spin Palacen kanssa. view(){
 //Write here logic and return to page.
Retrun page;
 }
}
2. New overridden:
  We have requirement check which user (Partner/Standard) logged in and view the page and perform the New Button action.
S-Control:
try{
// get the current login user.
var isPortealUser=sforce.apex.execute(‘CheckedUser’,’isPartnerUser’,{});
// if it is portal user it directed to account search visual force page.else it is directed to recordtype selection page.
if(isPortealUser==’true’){
top.location.href=’/apex/Sales_Menu_Partner?standAlone=yes’;
}else {
alert(“Please raise the request either from Account”);
window.parent.location.href=”/a1e/o”;
}
}catch(Error){
alert(Error);
}
 Apex class CheckedUser:
global class CheckedUser {
  WebService static boolean isPartnerUser(){
    boolean isPartnerUser=false;
    //Query to user object to get contact Id of current login user.
    User objUser=[Select Id,contactID from User where Id=:userinfo.getuserid()];
    //check contact Id is not null.
    if(objUser.contactID!=null){
    //if contact is not null,then current login user is partner user.Make isPartnerUser flag true.
        isPartnerUser=true;
     }
    return isPartnerUser;
   }
}

</div

zp8497586rq

You may also like