+ Start a Discussion
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student 

Redirecting to tabbed VF page after record deletion

Hey there,

 

I have recently solved a problem that has hounded me for weeks and that was how to re-direct to a certain tab in my tabbed VF accounts page after creating a new record (a child object to accounts). Immediately I have come across another problem and that is how to override the delete record button so that it will either(whichever is easier and/or quicker/simpler on the VF page):

 

A: Re-render the pageblock list of the records with the record deleted...without redirecting away from the page.

 

B: re-direct using the code that I have just used with the new records..but re-direct to the current tab.

 

Obviously, I feel that simply re-rendering the list will be more efficient and easier...i am just not 100% sure on where to even start. please help.

 

Mikie

Best Answer chosen by Admin (Salesforce Developers) 
ericmonteericmonte

All right mate here are the codes as I promised:

 

here is the VFPage i created to help you out

<apex:page standardController="Account" extensions="extAccountContact">
    <apex:form >
   <apex:pageBlock title="Hello {!$User.FirstName}!">
      You are viewing the {!account.name} account.
   </apex:pageBlock>
   <apex:pageBlock title="Contacts">
      <apex:pageBlockTable value="{!account.Contacts}" var="contact" id="block">
      
         <!-- Create a column for user to click on delete and delete the record -->
         <apex:column headerValue="Delete" >
             <!-- Command link allows you to create the value for the link and it allows you to call a action method from your extension -->
             <apex:commandLink value="delete"  action="{!deleteRecord}">
                 <!-- Paramerer value is to set the parameters being used in your extension then I assigned the parameters in to a string variable in the extension -->
                 <apex:param value="{!contact.id}" name="deleteRec" assignTo="{!delId }"/>
             
             </apex:commandLink>
         </apex:column>
         <apex:column value="{!contact.Name}"/>
         <apex:column value="{!contact.MailingCity}"/>
         <apex:column value="{!contact.Phone}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
   
   </apex:form>
</apex:page>

 now here is the extension:

public class extAccountContact {

    //string delId is used to set the parameter
    public string delId {get;set;}
    public Account acc {get;set;}

    public extAccountContact(ApexPages.StandardController controller) {
        this.acc = (Account)controller.getRecord();
    }
    
    //delete Record Page Reference basically deletes the record based on the parameter you set and redirectes to page.
    public PageReference deleteRecord() {
    
        Contact c = [select id from Contact where id =: delId];
        delete c;
        
        PageReference pageRef = new PageReference('/apex/AccountVFP?id='+acc.Id);
        pageRef.setredirect(true);

       
        return pageRef;
    }

}

 sorry for taking a little longer, i forgot about the setredirect(true) therefore my data wasn't getting refreshed. 

 

I hope this helps you out mate!

All Answers

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Thanks buddy, will have a look through these and mark as solution if I can find the answer in here.

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

 

Was not able to find my solution in there. I need something along the lines of:

 

Overiding the delete button so that it will refresh the current page (right down to the tab that is open) or just re-render the record list of the record that just got deleted with the record that just got deleted no longer in it. Does this make sense? Is it a possiblity?

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

I have attempted it, but each time when actually trying the delete button out I get : Id value 001N000000819na is not valid for the Fact_Finder__c standard controller.

 

I followed isntructions, but I think I did them wrong.

 

I overrode the Fact_finder__c delete button with this VF page:

 

<apex:page standardController="Fact_Finder__c" extensions="CustomObjectDeleteControllerExt" action="{!customDelete}">
</apex:page>

 and this is the controller:

 

public class CustomObjectDeleteControllerExt {
    public Fact_finder__c fac;

    public CustomObjectDeleteControllerExt(ApexPages.StandardController stdController) {
        this.fac = (Fact_finder__c)stdController.getRecord();
    }

    public PageReference customDelete(){
        delete fac;

        // Return whatever PageReference you want here
        PageReference pageRef= new PageReference('/apex/DestinyAccount?id='+fac.account__c+'&Sfdc.override=1');
        pageRef.getParameters().put('tab','FactFinder');
        return pageRef;
     }
}

 I have attempted to make it similar to my save extension which works and is this:

 

public class extSaveButton {
 
    public Fact_Finder__c fac {get;set;}
    public extSaveButton(ApexPages.StandardController controller) {
        this.fac = (Fact_Finder__C)controller.getRecord();

    }
    
    Public PageReference saveFactFinder(){
    
        insert fac;
        // Send the user to the detail page for the new account.
       PageReference pageRef= new PageReference('/apex/DestinyAccount?id='+fac.account__c+'&Sfdc.override=1');
        pageRef.getParameters().put('tab','FactFinder');
        return pageRef;
    
    }

}

 

ericmonteericmonte

Sorry for getting back late, but i have some questions:

 

1. You have a custom Account Page and it has a tabbed with Fact Finder?

2. Are you pulling the Fact Finder into a page block table or a list?

3. Are you deleting this record from the fact finder detail page that is out of the box, and you want to redirect it to the Account page?

4. Or are you deleting it from the Account Page and you want to redirect it?

 

Can you provide you Account VF page?

 

Also, if your fact finder is in the Account Page and the results are being shown based on the page block table, you can easily create a new parameter that allows you just delete that record and refresh the page after deletion. Let m eknow what you have and i'll see what i can come up with.

 

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Not at all man, you are helping me and I am willing to work around you.

 

1 & 2: I think the answer is yes and into a pageblocktable, this is the fact Finder section of my Accounts VF page my code:

 

<apex:tab label="Fact Finder" rendered="{!$ObjectType.Fact_Finder__c.Accessible}" name="FactFinder" id="tabFactFinder" >
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying Fact Finders from the {!account.name} account.Click a Fact Finder to view its details.
</apex:pageBlock>
<apex:pageBlock title="Fact Finder" >
<apex:form >
<apex:pageBlockTable value="{!account.Fact_Finder__r}" var="Fac" cellPadding="4" border="4" >
<apex:column headerValue="Fact Finder" >
<apex:commandLink rerender="details" oncomplete="highlightElem(this);"> {!Fac.Name}
<apex:param name="Fid" value="{!Fac.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!Fac.Employed_Since__c}" />
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="details">
<apex:detail subject="{!$CurrentPage.parameters.Fid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>

 3 & 4:. So, I have overridden the delete button from the Fact_Finder__c object and when I test it out, I am clicking the delete that is found, when I am on the Fact_Finder__c tab and I have clicked one of the records and the bottom half of the tab re-renders with the details of the record (detail is identical to what you would see should you look at the standard apge layout). I click the standard delete button at the top in the middle of the details page. Then I want it to re-direct to my accounts vF apge ( PageReference pageRef= new PageReference('/apex/DestinyAccount?id='+fac.account__c+'&Sfdc.override=1');
        pageRef.getParameters().put('tab','FactFinder');.

 

Although, officially I am deleting it from the Accounts page, I still think that it is considered me deleting from the Fact_Finder page as it is rendered onto the page.

 

Here is my code:

 

<apex:page standardController="Account" extensions="AccountExtension" showHeader="true" 
tabStyle="account"  >
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"/>
<apex:stylesheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/ui-lightness/jquery-ui.css"/>
<script>
$j = jQuery.noConflict();
function highlightElem(elem){
$j(elem).parent().parent().parent().find('tr').removeClass('ui-state-highlight');
$j(elem).parent().parent().addClass('ui-state-highlight');
}
</script>

<style>
.activeTab {background-color: #892034; color:White;
background-image:none}
.inactiveTab { background-color: #00204E; color:white;
background-image:none}
</style>

<style>
input[name=newNote] {
    display: none;
}
</style>

<apex:tabPanel switchType="client" value="{!BLANKVALUE($CurrentPage.parameters.tab,'AccountDetail')}"
id="AccountTabPanel" tabClass="activeTab"
inactiveTabClass="inactiveTab">
<apex:tab label="Details" name="AccDetails" id="tabdetails" >
<apex:detail inlineEdit="True" relatedList="true" title="true"/>
</apex:tab>
<apex:tab label="Contacts" name="Contacts" id="tabContact">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying contacts from the {!account.name} account.
Click a contact's name to view his or her details.
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:form >
<apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4"
border="1">
<apex:column >
<apex:commandLink rerender="detail" oncomplete="highlightElem(this);">
{!contact.Name}
<apex:param name="cid" value="{!contact.id}"/>
</apex:commandLink>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="True" inlineEdit="True"
title="false"/>
</apex:outputPanel>
</apex:tab>

<apex:tab label="Fact Finder" rendered="{!$ObjectType.Fact_Finder__c.Accessible}" name="FactFinder" id="tabFactFinder" >
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying Fact Finders from the {!account.name} account.Click a Fact Finder to view its details.
</apex:pageBlock>
<apex:pageBlock title="Fact Finder" >
<apex:form >
<apex:outputlink value="/apT/e?CF00N90000009tQcp={!Account.name}&CF00N90000009tQcp_lkid= {!Account.id}">Create New Fact Finder</apex:outputlink>
<apex:pageBlockTable value="{!account.Fact_Finder__r}" var="Fac" cellPadding="4" border="4" >
<apex:column headerValue="Fact Finder" >
<apex:commandLink rerender="details" oncomplete="highlightElem(this);"> {!Fac.Name}
<apex:param name="Fid" value="{!Fac.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!Fac.Employed_Since__c}" />
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="details">
<apex:detail subject="{!$CurrentPage.parameters.Fid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Destiny Products" rendered="{!$ObjectType.Destiny_Products__c.Accessible}" name="Destiny Products" id="tabDestinyProducts" >
<apex:pageBlock title="Destiny Products" >
<apex:form >
<apex:outputlink value="/apT/e?CF00N90000009tQcU={!Account.name}&CF00N90000009tQcU_lkid=                                                                                                                           {!Account.id}">Create New Destiny Product</apex:outputlink> 
<apex:pageBlockTable value="{!account.Destiny_Products_and_services__r}" var="Pro" cellPadding="4"  border="4">
<apex:column headerValue="Destiny Products"  >
<apex:commandLink rerender="Prodetails" oncomplete="highlightElem(this);"> {!Pro.Name}
<apex:param name="Pid" value="{!Pro.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!Pro.Product_Name__c}"  />
<apex:column value="{!Pro.Product_Stage__c}" />
<apex:column value="{!Pro.Payment_Choice__c}" />
<apex:column value="{!Pro.Amount_Owed__c}" />
<apex:column value="{!Pro.CreatedDate}" />
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="Prodetails">
<apex:detail subject="{!$CurrentPage.parameters.Pid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Destiny Services" rendered="{!$ObjectType.Service__c.Accessible}" name="Destiny Services" id="tabDestinyServices" >
<apex:pageBlock title="Destiny Services" >
<apex:form >
<apex:outputlink value="/apL/e?CF00N90000009Tqce={!Account.name}&CF00N90000009Tqce_lkid=                                                                                                                           {!Account.id}">Create New Destiny Service</apex:outputlink> 
<apex:pageBlockTable value="{!account.Services__r}" var="Ser" cellPadding="4"  border="4">
<apex:column headerValue="Destiny Services"  >
<apex:commandLink rerender="Serdetails" oncomplete="highlightElem(this);"> {!Ser.Name}
<apex:param name="Sid" value="{!Ser.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!Ser.Service_Name__c}"/>
<apex:column value="{!Ser.Service_Stage__c}"/>
<apex:column value="{!Ser.Payment_Choice__c}"/>
<apex:column value="{!Ser.Amount_Owed__c}"/>
<apex:column value="{!Ser.CreatedDate}"/>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="Serdetails">
<apex:detail subject="{!$CurrentPage.parameters.Sid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Transactions" rendered="{!$ObjectType.Transaction__c.Accessible}" name="Transactions" id="tabTransactions" >
<apex:pageBlock title="Transactions" >
<apex:form >
<apex:outputlink value="/aNQ/e?CF00N9000000AhTy={!Account.name}&CF00N9000000AhTy_lkid=                                                                                                                           {!Account.id}">Create New Transaction</apex:outputlink> 
<apex:pageBlockTable value="{!account.Transactions__r}" var="Tra" cellPadding="4"  border="4">
<apex:column headerValue="Transactions" >
<apex:commandLink rerender="Tradetails" oncomplete="highlightElem(this);"> {!Tra.Name}
<apex:param name="Tid" value="{!Tra.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!Tra.Amount__c}"/>
<apex:column value="{!Tra.Method__c}"/>
<apex:column value="{!Tra.Transaction_Type__c}"/>
<apex:column value="{!Tra.Date_of_Payment__c}"/>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="Tradetails">
<apex:detail subject="{!$CurrentPage.parameters.Tid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Activities" name="OpenActivities"
id="tabOpenAct">
<apex:relatedList subject="{!account}"
list="OpenActivities" />
<apex:relatedList subject="{!account}"
list="ActivityHistories" />
</apex:tab>
<apex:tab label="Compliance Notes" rendered="{!$ObjectType.Notes__c.Accessible}" name="Compliance Notes" id="tabComplianceNotes" >
<apex:pageBlock title="Compliance Notes" >
<apex:form >
<apex:outputlink value="/avY/e?CF00N90000003pGyl={!Account.name}&CF00N90000003pGyl_lkid=  {!Account.id}">Create New Compliance Note</apex:outputlink> 
<apex:pageBlockTable value="{!account.Compliance_Notes__r}" var="Com" cellPadding="4"  border="4">
<apex:column headerValue="Compliance Notes" >
<apex:commandLink rerender="Comdetails" oncomplete="highlightElem(this);"> {!Com.Name}
<apex:param name="Nid" value="{!Com.id}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!Com.Action__c}"/>
<apex:column value="{!Com.Action_Subject__c}"/>
<apex:column value="{!Com.Action_Location__c}"/>
<apex:column value="{!Com.Agent__c}"/>
<apex:column value="{!Com.Time__c}"/>
</apex:pageBlockTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="Comdetails">
<apex:detail subject="{!$CurrentPage.parameters.Nid}" relatedList="False" inlineEdit="True" title="false"/>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Attachments"
name="Attachments" id="tabAttachments"  >
<apex:form >
<apex:pageBlock title="Attachment" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save"
action="{!save}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection collapsible="false"
columns="1" >
<apex:inputHidden value="{!account.Name}"/>
<apex:outputText value="Attachment: "/><apex:inputFile value="{!attach.body}" filename="{!attach.name}"/><br/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:relatedList subject="{!account}" title="Attachments"
list="NotesAndAttachments" >   
</apex:relatedList>
</apex:tab>
</apex:tabPanel>
</apex:page>

 Thank you so much for your help!

 

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Ps. This line  pageRef.getParameters().put('tab','FactFinder' works with this line in the VF page:

<apex:tabPanel switchType="client" value="{!BLANKVALUE($CurrentPage.parameters.tab,'AccountDetail')}"
id="AccountTabPanel" tabClass="activeTab"
inactiveTabClass="inactiveTab">

 

 to re-direct to the tab of the record that was just deleted....there is probably an easier way to do this...

ericmonteericmonte
I am going to make your life easier on that delete button. I'm going to add a column for delete, which will be a URL and had a delete function. It will basically take the id of that record delete it and refreshes the account page. I actually did something similar in one of my vf page a longtime ago and I'm going to retool it for delete. Give me a few hours and ill post it up.
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

You are an absolute legend mate!

ericmonteericmonte

All right mate here are the codes as I promised:

 

here is the VFPage i created to help you out

<apex:page standardController="Account" extensions="extAccountContact">
    <apex:form >
   <apex:pageBlock title="Hello {!$User.FirstName}!">
      You are viewing the {!account.name} account.
   </apex:pageBlock>
   <apex:pageBlock title="Contacts">
      <apex:pageBlockTable value="{!account.Contacts}" var="contact" id="block">
      
         <!-- Create a column for user to click on delete and delete the record -->
         <apex:column headerValue="Delete" >
             <!-- Command link allows you to create the value for the link and it allows you to call a action method from your extension -->
             <apex:commandLink value="delete"  action="{!deleteRecord}">
                 <!-- Paramerer value is to set the parameters being used in your extension then I assigned the parameters in to a string variable in the extension -->
                 <apex:param value="{!contact.id}" name="deleteRec" assignTo="{!delId }"/>
             
             </apex:commandLink>
         </apex:column>
         <apex:column value="{!contact.Name}"/>
         <apex:column value="{!contact.MailingCity}"/>
         <apex:column value="{!contact.Phone}"/>
      </apex:pageBlockTable>
   </apex:pageBlock>
   
   </apex:form>
</apex:page>

 now here is the extension:

public class extAccountContact {

    //string delId is used to set the parameter
    public string delId {get;set;}
    public Account acc {get;set;}

    public extAccountContact(ApexPages.StandardController controller) {
        this.acc = (Account)controller.getRecord();
    }
    
    //delete Record Page Reference basically deletes the record based on the parameter you set and redirectes to page.
    public PageReference deleteRecord() {
    
        Contact c = [select id from Contact where id =: delId];
        delete c;
        
        PageReference pageRef = new PageReference('/apex/AccountVFP?id='+acc.Id);
        pageRef.setredirect(true);

       
        return pageRef;
    }

}

 sorry for taking a little longer, i forgot about the setredirect(true) therefore my data wasn't getting refreshed. 

 

I hope this helps you out mate!

This was selected as the best answer
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Hey, thank you so much for your help. I just had a few questions...

 

1. Would I need a separate extension for every custom object or just the one which I add to?

 

2. I attempted to change it for fact_finder__c except it would not work so I just left it as contact and it deletes fine. But, will this same extension work for my other custom objects?

 

3. Would my tab redirection statements work in the extension so that it will re-direct to the right tab of the VF page? ( pageRef.getParameters().put('tab','FactFinder');)

 

Thank you for your help and time. 

ericmonteericmonte
1 you can use the same extension.
2 the reason why it didn't work fact finder because you probably not querying the fact finder record. So in my example, I have contacts I have the id of that record but I had to query the record then delete. Maybe I should have made it for more dynamic. Let me see if I can get it more dynamic and I'll send it to you.

3 it should be fine.
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

You are the man, already tested it out and the tab re-directing formula does work. So sweet, its also good that I wont need a million extensions. Will it work with the same broad extension, or will it be an extension that has a bit added for every object that I add the delete button to?

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Hey Eric, I have had a little play around and have managed to have the extension Delete two separate records with the same extension. I was hoping you could have a look at this to tell me how I have went. Does the extension look alright to you? 

public class extAccountDel {

    //string delId is used to set the parameter
    public string delId {get;set;}
    public Account acc {get;set;}

    public extAccountDel (ApexPages.StandardController controller) {
        this.acc = (Account)controller.getRecord();
    }
    
    //delete Record Page Reference basically deletes the record based on the parameter you set and redirectes to page.
    public PageReference deleteFacRecord() {
    
        Fact_Finder__c Fac = [select id from Fact_Finder__c where id =: delId];
        delete Fac;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','FactFinder');
        pageRef.setredirect(true);

       
        return pageRef;
    }
    
    
 //delete Record Page Reference basically deletes the record based on the parameter you set and redirectes to page.
    public PageReference deleteProRecord() {
    
        Destiny_Products__c Pro = [select id from Destiny_Products__c where id =: delId];
        delete Pro;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','Destiny Products');
        pageRef.setredirect(true);
        
         return pageRef;
}

}

 I really feel like I have gone up levels in my coding abilities from the few times you have helped me so thank you. Let me know what you think.

Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Final code all because of you mate. Tell me what you think

 

public class extAccountDel {

    //string delId is used to set the parameter
    public string delId {get;set;}
    public Account acc {get;set;}

    public extAccountDel (ApexPages.StandardController controller) {
        this.acc = (Account)controller.getRecord();
    }
    
    //delete for Fact Finder record and then re-directs back to the VF page with the Fact Finder tab open
    public PageReference deleteFacRecord() {
    
        Fact_Finder__c Fac = [select id from Fact_Finder__c where id =: delId];
        delete Fac;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','FactFinder');
        pageRef.setredirect(true);

       
        return pageRef;
    }
    
    
 //delete for Destiny Products record and then re-directs back to the VF page with the Destiny Products tab open
    public PageReference deleteProRecord() {
    
        Destiny_Products__c Pro = [select id from Destiny_Products__c where id =: delId];
        delete Pro;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','Destiny Products');
        pageRef.setredirect(true);
        
         return pageRef;
}

 //delete for Destiny Services record and then re-directs back to the VF page with the Destiny Services tab open
    public PageReference deleteSerRecord() {
    
        Service__c Ser = [select id from Service__c where id =: delId];
        delete Ser;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','Destiny Services');
        pageRef.setredirect(true);
        
         return pageRef;
}

 //delete for Transactions record and then re-directs back to the VF page with the Transactions tab open
    public PageReference deleteTraRecord() {
    
        Transaction__c Tra = [select id from Transaction__c where id =: delId];
        delete Tra;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','Transactions');
        pageRef.setredirect(true);
        
         return pageRef;
}

 //delete for Compliance Notes record and then re-directs back to the VF page with the Compliance Notes tab open
    public PageReference deleteComRecord() {
    
        Notes__c Com = [select id from Notes__c where id =: delId];
        delete Com;
        
        
        
        PageReference pageRef= new PageReference('/apex/DestinyAccountTest?id='+acc.id+'&Sfdc.override=1');
         pageRef.getParameters().put('tab','Compliance Notes');
        pageRef.setredirect(true);
        
         return pageRef;
}

}

 

ericmonteericmonte
Hey looks good! Glad you got it working :)
Developer.mikie.Apex.StudentDeveloper.mikie.Apex.Student

Couldnt have done it without you mate