• Anzle TheThird
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies

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.

I am having trouble testing a portion of our solution leveraging Platform Events.  

I have an Apex Trigger on a Platform Event which after some logic publishes additional Platform Event.  

I cannot for the life of me get the 2nd Platform Events to fire in @Test methods.  They work fine in functional tests (not in Test context).  

Originally the trigger was firing the same type of Platform Event.  Thinking this may be the problem, I rearchitected the code to fire a separate Platform Event Type (__e).  I have also tried firing in @future methods.  And placing Test.getEventBus().deliver();  in the test method.  

Nothing seems to work.  Has anyone else encountered this?