+ Start a Discussion
Hey SandboxHey Sandbox 

Change the Case tabs to the Subject instead of the Case Number in Lightning(Service Cloud)

Is there anyway to change the Case tab title to the SUBJECT instead of the CASE NUMBER?

Please see below snapshot. 
User-added image

Your help will be highly appreciated.

Thanks in advance!
Prashant Raiyani
David HalesDavid Hales
Hi Prashant,
 
Try explicitly setting the title of the tab in your VF page such as:
 
<apex:page standardController="Case" standardStyleSheets="true" showHeader="false" sidebar="false">
     <apex:includeScript value="/support/console/22.0/integration.js"/>
     <script type="text/javascript">
            function defaultTabTitle() {
                //Set the current tab's title
                sforce.console.setTabTitle('Case: {!case.CaseNumber}');
          }
          var pageLoad = window.onload;
          window.onload = function() {
                 if (pageLoad) {
                         pageLoad();
                 }
                 defaultTabTitle();
          }
     </script>
     <apex:detail subject="{!case.Id}" relatedList="false" title="false" inlineedit="true"/>
</apex:page>

If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future. 

Thanks & Regards 
David Hales(1044)
Kloudrac Softwares Pvt. Ltd.
Pramodh KumarPramodh Kumar
This feature is not available yet in the lightning. I can't customize the lightning console as much as classic console. As it is still beta stage, I think in the coming release we may get any updates.

If you want to customize any custom anything please go through the workspaceAPI
https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_methods_lightning_tabs.htm


Thanks
Pramodh
Hey SandboxHey Sandbox
Hi Pramodh Kumar,

Yes, already tried this before week, but i can't save this lightning component due to Error:
Failed to save undefined: No COMPONENT named workspaceAPIAccess found: Source
ERROR on Componenet Save
On component line 2:
<force:workspaceAPIAccess aura:id="workspace" />
 I referring this example setTabLabel() for Lightning Experience (https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_setTabLabel.htm)

Please reply, If you have any solution for above error.

Thanks,
Prashant Raiyani
NagendraNagendra (Salesforce Developers) 
Hi Prashanth,

You can create a utility bar component and use the console toolkit method setTabLabel in conjunction with an event handler for the tabCreated event to set the label of a tab as it's opened. There's a sample for how to do this in the documentation here(https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_events_tabcreated.htm). You'd also need to find a way to retrieve the case subject, likely through an apex controller.

Thanks,
Nagendra
Ido Greenbaum 10Ido Greenbaum 10

Prashant, 
If you are able to acheive this, please kindly share here. 

Thank you. 

Pramodh KumarPramodh Kumar
@Prashanth

workspaceAPI is available only API version 40. If your component is using below 40 then it wont able to save the component. 


Here is my code
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">
    <aura:attribute name="recordId" type="Id"/> 
    <force:workspaceAPIAccess aura:id="workspace" />
    <ui:button press="{!c.doInit}" label="Update"></ui:button>
</aura:component>
({
    doInit : function(component) {        	
        var workspaceAPI = component.find("workspace");         
        workspaceAPI.getFocusedTabInfo({ 
            callback : function(error, response){            
                var focusedTabId = response.tabId;                
                workspaceAPI.openSubtab({
                    url : '#/sObject/005R0000000INjPIAW/view',
                    focus: true                    
                }); 
            }            
        });        
    }
})


Thanks
Pramodh
Hey SandboxHey Sandbox
@Pramodh Kumar

Still No Success! Using same API version 40.
Reused same code from above.
Component Meta XML
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>40.0</apiVersion>
    <description>Lightning Console JavaScript API</description>
</AuraDefinitionBundle>
API Verion 40 from Bundle Version Settings.

API 40

Same error occured.

Thanks,
Prashant Raiyani
Andrea CatalanoAndrea Catalano
Hi,
   the "No COMPONENT named workspaceAPIAccess found" error shoult be related to the Javascript API that, at the moment I'm writing (Summer '17), is in Pilot and you neet it enabled on your org (by support request if apply).
Hey SandboxHey Sandbox
Hi Andrea,

Yes, I've followed the same for my DEV Org.
Sandobx & Production accounts require a Pilot agreement to use the JS APIs in Lightning.
Note that the syntax will be changing in Winter '18. Prerelease program should be live in a few days, and they'll have updated syntax guide live in about a week as well.

Thanks,
Prashant Raiyani
sumedha govindaraya 9sumedha govindaraya 9
Hi Prashant,
How did you resolve the issue? I have to achieve the same requirement and any help is appreciated.

Thanks,
Sumedha
Erik Hamelink 2Erik Hamelink 2
User-added image
User-added image
Add this to all pages where you want the label to be any field on the current object.

this is the code:
lightningConsoleLabelChanger.cmp
<aura:component
	implements="force:hasRecordId,flexipage:availableForAllPageTypes"
>
	<aura:handler name="init" action="{!c.doInit}" value="{!this}" />
	<aura:attribute name="recordId" type="Id" />
	<aura:attribute name="fieldName" type="String" default="Name" />
	<aura:attribute name="record" type="Object" />
	<aura:attribute name="simpleRecord" type="Object" />
	<aura:attribute name="recordError" type="String" />

	<force:recordData
		aura:id="recordLoader"
		targetFields="{!v.simpleRecord}"
		targetError="{!v.recordError}"
		recordUpdated="{!c.handleRecordUpdated}"
	/>

	<lightning:workspaceAPI aura:id="workspace" />
</aura:component>
lightningConsoleLabelChangerController.js
({
	doInit: function (cmp) {
		var RecordId = cmp.get("v.recordId");
		var field = cmp.get("v.fieldName");
		cmp.find("recordLoader").set("v.recordId", RecordId);
		cmp.find("recordLoader").set("v.fields", [field]);
		cmp.find("recordLoader").reloadRecord();
	},

	handleRecordUpdated: function (cmp) {
		let field = cmp.get("v.fieldName");
		let labelValue = cmp.get("v.simpleRecord." + field);
		var workspaceAPI = cmp.find("workspace");

		if (labelValue) {
			workspaceAPI
				.getFocusedTabInfo()
				.then(function (response) {
					var focusedTabId = response.tabId;
					workspaceAPI.setTabLabel({
						tabId: focusedTabId,
						label: labelValue
					});
				})
				.catch(function (error) {
					console.log(error);
				});
		}
	}
});
lightningConsoleLabelChanger.design
<design:component>
	<design:attribute
		name="fieldName"
		label="Field"
		description="The name of the field to use for the label"
		required="true"
	/>
</design:component>

Good luck!

If the above suggestion worked, let us know by marking the answer as "Best Answer" right under the comment which will help the rest of the community should they have a similar issue in the future. 
Suraj MallaSuraj Malla
Thanks Erik Hamelink 2. It works well.
David KreitzerDavid Kreitzer
Erik Hamelink 2, thanks for this!  I was able to create the component, but when I add it to a page the option to set the field does not appear.  Any help would be appreciated, thank you! 

User-added image