• Subha Savithri
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I am new to salesforce and i face a problem.
My problem is I want to redirect to the same visualforce page when New and Edit button is clicked from another Vf page.
Is it possible to change the Page Heading as "Add Request" when clicking Add and "Edit Request" when clicking Edit button? Please help
Below is my code to change the Request Field value to after deleting. It works fine, but not all the time. When i delete primary request, the secondary request must be changed to primary and the tertiary must change to secondary. 
Sometimes when i delete primary, tertiary is changed to secondary but secondary is not changing to primary. Any idea please.

List<Reclassification_Request__c> lstSecondaryReq  =[Select Id,Name,Request__c, MGCRB_CBSA_Code__c from Reclassification_Request__c where Request__c='Secondary Request' LIMIT 1];
       List<Reclassification_Request__c> lstTertiaryReq  =[Select Id,Name,Request__c, MGCRB_CBSA_Code__c from Reclassification_Request__c where Request__c='Tertiary Request' LIMIT 1];
       For(Reclassification_Request__c RR : Trigger.old) {
       If (RR.Request__c == 'Primary Request') 
            {                                
                    If (lstSecondaryReq != null &&  lstSecondaryReq.size() > 0) {
                    Reclassification_Request__c SecondaryReq = new Reclassification_Request__c();    
                    SecondaryReq = lstSecondaryReq[0];
                    System.debug('Current Value To Modified '+SecondaryReq.Request__c);
                    SecondaryReq.Request__c = 'Primary Request';
                    update SecondaryReq ;
                    System.Debug('Primary to Secondary Update Completed'+SecondaryReq.Request__c);
                }
            
                If (lstTertiaryReq!= null && lstTertiaryReq.size() > 0) {
                Reclassification_Request__c TertiaryReq = new Reclassification_Request__c();    
                TertiaryReq = lstTertiaryReq[0];
                TertiaryReq.Request__c = 'Secondary Request';
                update TertiaryReq;
            }
     } else if (RR.Request__c == 'Secondary Request') 
            {
                If (lstTertiaryReq!= null && lstTertiaryReq.size() > 0) {
                Reclassification_Request__c TertiaryReq = new Reclassification_Request__c();    
                TertiaryReq = lstTertiaryReq[0];
                TertiaryReq.Request__c = 'Secondary Request';
                update TertiaryReq;
            }            
     }
       }
 
I am new to salesforce and i face a problem.
My problem is I want to redirect to the same visualforce page when New and Edit button is clicked from another Vf page.
Is it possible to change the Page Heading as "Add Request" when clicking Add and "Edit Request" when clicking Edit button? Please help