+ Start a Discussion
Oliver Freeman 9Oliver Freeman 9 

Close Tab after Save - Service Console

Hi there!

I'm looking for a way to automatically close a record tab in Salesforce Service Console when I create a new record.

I'm using a custom object called Configuration Resource(s), these are added to the parent record (Configuration object), from a related list on the Configuration object page layout.
Ideally, I need to be able to have the tab that opens when the new configuration resource is created, close after saving, is this possible?
Akshay Deshmukh1Akshay Deshmukh1

Have you tried Service Console Toolkit functions? You may need to override new button from Master's related list to create a child. Create a button which will open VF page and use Console Toolkit inside VF page. There are lots of functions to open(), Close() tab/subtab etc in toolkit.

Oliver Freeman 9Oliver Freeman 9

I've tried to implement this as you explained, by creating a Visualforce page which displays the input fields required for the object, and have used the following code:
<apex:page standardController="Bench_Resource__c" showHeader="false" sidebar="false">
<apex:sectionHeader title="Add A Resource" subtitle="New Configuration Resource"/>
<apex:form >
    <apex:pageBlock title="Add Resource" mode="edit">
        <apex:pageBlockButtons >
            <apex:commandButton action="{!save}" oncomplete="closeTab(); return false;" value="Add to List"/>
    		<apex:commandButton value="Cancel" onclick="tab.close()"/>
        <apex:pageBlockSection title="Resource Details" columns="2">
            <apex:inputField label="Resource" value="{!Bench_Resource__c.Resource__c}"/>
            <apex:inputField label="Resource Role" value="{!Bench_Resource__c.Resource_Role__c}"/>

But this doesn't close the tab after it's saved, it shows the new record if that makes sense? Obviously it closes the record creation page, but then returns to the new record view, I need it to close this upon save and return to the primary tab, and I can't work out how to do this.

Jason Kuzmak 12Jason Kuzmak 12

@Oliver Freeman 9

Any resolution on this? Also having this problem.