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
theressa999theressa999 

Problem with ProfileTabVisibility for Standard Tabs using metadata API

Hi Guys,

 

I have a problem in setting ProfileTabVisibililty to standard tabs like "Accounts", "Leads".

 

Following code works fine with the custom tabs but not with standard tabs. Please help me as this is very urgent to me.

 

Profile p=new Profile();

 

p.setFullName(ProfileName);

ProfileTabVisibility ptv = new ProfileTabVisibility("__samp__c",TabVisibility.DefaultOn );

ProfileTabVisibility[] tabVisibilities = new ProfileTabVisibility[] {ptv};

p.setTabVisibilities(tabVisibilities);

UpdateMetadata updateMetadata = new UpdateMetadata(ProfileName, p);

System.out.println(p.getTabVisibilities(0).getTab());

 

 

AsyncResult[] ars= metadatabinding.update(new UpdateMetadata[] { updateMetadata });

 

This works fine.

 

But when I use standard tabs like "Account" it says

 

INVALID_CROSS_REFERENCE_KEY msg: In field: tab - no CustomTab named Account found

 

 

Anything that i set in ProfileTabVisibility is treated as CustomTab.

 

How can I set tab visibility for Standard Tab?

 

Quick reply would help me a lot.

 

Awaiting for your reply,

 

Praneeth.

theressa999theressa999
Anybody come across the solution to my problem????
Anzle TheThirdAnzle TheThird

This was asked a long long time ago but for anyone who stumbles across it, 
for profile tab visibility has the following structure for standard Objects: 

[{
       'tab': 'standard-Account',
       'visibility': 'DefaultOn'
},]

so I'd suggest trying to add the "standard-" infront of account when trying to do this.