function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ridhima Saxena 20Ridhima Saxena 20 

How to write name of aura component inside custom tab using metadata API?

Hii Team,
My requirement is whenever I create custom object it should create custom tab with aura component.
Here is my code.Hoow to write my aura component name to display on tab
  MetadataService.CustomTab customTab = new MetadataService.CustomTab();
        customTab.FullName = objname + '__c'; 
        customTab.Motif = 'Custom70: Handsaw'; 
        customTab.CustomObject = false;
 customTab.auraComponent = 'c:dashboardcreationForm';  (this thing how to write to call my aura component)
        fields.add(customTab); 
        system.debug('CustomTab--' +customTab);     
        service.createMetadata(fields);
AnudeepAnudeep (Salesforce Developers) 
'auraComponent'  field in the Metadata is a string type and you can just specify the name of the lightning component 

Also, note that as per the documentation, you can only populate one of the following fields. I see you are already populating CustomObject ( customTab.CustomObject = false;) so you cannot use auraComponent

Only one of these fields can have a value set:

auraComponent
customObject
flexiPage
lwcComponent
page
scontrol
url


When you add the force:appHostable interface to an Aura component to allow it to be used as a custom tab in Lightning Experience you will use it's name in the auraComponent field. For example 

customTab.auraComponent = 'simpleTab';
 
<!--simpleTab.cmp-->
<aura:component implements="force:appHostable">
 
    <!-- Simple tab content -->
 
    <h1>Lightning Component Tab</h1>
 
</aura:component>

If you find this information helpful, please mark this answer as Best. It may help others in the community

Thanks, 
Anudeep