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
reema_agarwalreema_agarwal 

java code to list all the objects in salesforce

I want a list all the objects present in my salesforce application in a java application after i login into SFDC from a java api.

can someone please help me

 

Thanks!

Navatar_DbSupNavatar_DbSup

Hi,

Try the below code snippet as reference:

 

public class allSFDCObjects

{

 static final String USERNAME = "username";

 static final String PASSWORD = "password+sectoken";

 static EnterpriseConnection connection;

 public static ConnectorConfig config = new ConnectorConfig();

 

 public static void main(String[] args)

    {

   getAllSFDCObjects();

    }

 

 public static void getAllSFDCObjects()

    {

     try

     {

      config.setUsername(USERNAME);

      config.setPassword(PASSWORD);

      connection = Connector.newConnection(config);

      DescribeGlobalResult res = connection.describeGlobal();

      System.out.println("Objects::"+res.toString());

     }

     catch (Exception e)

     {

     // TODO Auto-generated catch block

     e.printStackTrace();

     System.out.println("Exception:: " + e.getMessage());

     }

    }

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

GirinoobGirinoob

Hi,

can you give sample code on how to get list of all fields of an SObject in Java.