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
sasihari371.3947835833936902E12sasihari371.3947835833936902E12 

Custom Webtab creation via Java API

Hi all,
Can anyone help me in creating the custom webtab through salesforce java api??
Ashish_SFDCAshish_SFDC
Hi Sasi, 


Need some more information on this, do you already have the Java based Web URL working? 

Is it a stand alone app? 


Regards,
Ashish

sasi harisasi hari
Hi Ashish,

It is a standalone app.
I am using the SOAP API to create the custom webtab.
I created it.
But it is not visible to the Standard applications of the profile.


            ProfileTabVisibility tabVisible = new ProfileTabVisibility();
            tabVisible.setTab(cust.getFullName());
            tabVisible.setVisibility(TabVisibility.DefaultOn);
          
            ProfileApplicationVisibility appVisibility =
                    new ProfileApplicationVisibility();
            appVisibility.setApplication("Sales");
            appVisibility.setVisible(true);

            Profile admin = new Profile();
            admin.setFullName("Admin");
            admin.setTabVisibilities(new ProfileTabVisibility[]{tabVisible});
            admin.setApplicationVisibilities(new ProfileApplicationVisibility[]{appVisibility});
            System.out.print("#####"+admin.getCustom());
            UpdateMetadata up = new UpdateMetadata();
            up.setMetadata(admin);


Error status code: INVALID_CROSS_REFERENCE_KEY
Error message: In field: application - no CustomApplication named Sales found

Ashish_SFDCAshish_SFDC
Hi Sasi, 


I woudl recommend you to create a web tab using UI and create a visualforce page for the Web App and BIND the controller to the external App. 


Regards,
Ashish
sasi harisasi hari
Hi Ashish,

I need Custom webtabs to be created from JAVA Metadata API only.. Kindly help in that....
Ashish_SFDCAshish_SFDC
HI Sasi, 


Go through the resources below, 


Short Video, 

http://www.cirrusinsight.com/salesforce/how-to/how-to-create-a-custom-web-tab-in-salesforce/


How do I create a custom web tab?
videoWatch video
Overview
What is a custom web tab?
A web tab is a custom tab that displays web content or applications embedded in a Salesforce CRM window. For instance, you can create a tab to view your company’s intranet or a wiki that you use frequently so that you can find the information you need without leaving your Salesforce CRM.
Why are custom web tabs important?
Custom tabs enable you to create a specific set of web tabs customized for the web pages you use most frequently.
Create a custom web tab
Click Setup —› App Setup —› Create —› Tabs
Click New next to Web Tabs.
Choose Tab Layout and then click Next – you can either choose to have the content run across the full page width, or to include the sidebar to help you navigate your Salesforce CRM.
Choose the Tab Type:
URL – Choose this if you want to show the content of a web page in the tab, like a map webpage or a wiki.
Custom S-Control – Choose this if you have previously created a custom s-control that you want displayed in the web tab. S-Controls can contain any type of content that you can display or run in a browser.
Enter Label – This will be the name of the tab. It should be an easy way for people to know what the tab contains.
Enter Tab Name – This is a unique name that will ensure there are no naming conflicts within Salesforce. Hover over the information button for more details.
Select Tab Style – Salesforce CRM has a number of different colors and tab styles you can choose from.
Enter Content Frame Height – This determines the length of the page eyou create.
Click Next when you’re done filling out the information on this page.
Select Merge Field – Salesforce CRM can use one or more merge fields to insert data from your Salesforce CRM into the URL in the web tab.
Select Encoding – If you are based in the United States, then you can leave the Encoding selection as “Unicode (UTF-8)”. Otherwise, choose the Encoding for your web content.
Click Next when you’re done filling out the information on this page.
Choose the Applications to which you want to add your tab.
Click Save when you’re done.


http://www.salesforce.com/in/smallbusinesscenter/faq/customize.jsp#customwebtabhttp://www.salesforce.com/in/smallbusinesscenter/faq/customize.jsp#customwebtab


Regards,
Ashish
sasi harisasi hari
Ashish,

I need your help in creating the custom webtab with java metadata api.
Help me in this regard.

Ashish_SFDCAshish_SFDC

Hi Sasi, 


Did you go through the links shared above? 

Try to Start over and post on the Community where you face issues. 


Regards,

Ashish


 

sasi harisasi hari
Hi Ashish,

Go through the below code for creating custom webtab,


CustomTab cust = new CustomTab();
        cust.setLabel("Cust Label");
        cust.setUrl("https://localhost:8443/");
        cust.setMotif("Custom52: Balls");
        cust.setUrlEncodingKey(Encoding.Big5);
        cust.setDescription("My Webtab");
        cust.setHasSidebar(true);
        cust.setFullName("webtab_c");
        cust.setMobileReady(true);
        cust.setFrameHeight(600);


ProfileTabVisibility tabVisible = new ProfileTabVisibility();
            tabVisible.setTab(cust.getFullName());
            tabVisible.setVisibility(TabVisibility.DefaultOn);

            ProfileApplicationVisibility appVisibility =
                    new ProfileApplicationVisibility();
            appVisibility.setApplication("Sales"); //////////////////////////////////////////////////////ERROR MAY BE HERE//////////////////////////////////////////////////////////
            appVisibility.setVisible(true);


            Profile admin = new Profile();
            admin.setFullName("Admin");
            admin.setTabVisibilities(new ProfileTabVisibility[]{tabVisible});
            admin.setApplicationVisibilities(new ProfileApplicationVisibility[]{appVisibility});
            UpdateMetadata up = new UpdateMetadata();
            up.setMetadata(admin);

//            System.out.println(up.toString());


  MetadataConnection metadataConnection = com.sforce.soap.metadata.Connector.newConnection(metadataConfig);
            AsyncResult[] ars = metadataConnection.create(new Metadata[]{cust});



Error status code: INVALID_CROSS_REFERENCE_KEY
Error message: In field: application - no CustomApplication named Sales found


i'm getting error while setting visibility of Custom webtab in Sales Application i.e, standard application. How to set the visibility of custom tab in standard application?


Or just inform me with the API Name to access the standard applications in SF....!!






Ashish_SFDCAshish_SFDC
Hi Sasi, 


You can do that through the UI, 

Go to | Setup | Create | Apps | App | Edit | Select from the available List of Tabs | Add | Save. 

https://help.salesforce.com/htviewhelpdoc?err=1&id=dev_tabsetcreate.htm&siteLang=en_US


Regards,
Ashish