• PNS
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi...

 

Is there any Java programmatic way of retrieving the version of the Salesforce API one uses for their development? There is a getApiVersion() method in the ApexClass of the Enterprise API but I am using the Partner API which does not seem to offer something similar. A PackageVersion class in both the Enterprise and the Partner APIs seems irrelevant to this purpose.

 

Also, is there any Java programmatic way of retrieving the current API version (e.g., say someone uses API v20 and Salesforce has released API v21)?

 

Thanks!

  • February 12, 2011
  • Like
  • 1

 Hi...

 

I am playing with a test Salesforce database and trying to figure out how to download its contents (i.e., do a full database "dump") into my machines memory, in SObject objects (returned from QueryResult.getRecords()).

 

I am using the Partner API and so far only access the standard Salesforce objects. As far as I can tell, there are 3 categories of those:

 

 

  • Fully queryable (most of them, e.g. Account, Opportunity, Contract, User etc.).
  • Partially queryable, i.e. queryable but restricted by implementation (Vote, UserProfileFeed)
  • Non-queryable (FeedPost, AggregateResult, Name, NoteAndAttachment, ActivityHistory, FeedComment, OpenActivity, EmailStatus, ProcessInstanceHistory)

 

If, in a database with information only stored in standard objects, I download, with appropriate queries, all fully queryable objects, plus somehow (join-like) the remaining few ones (partially- and non-queryable), would that be a the equivalent of the "full dump" of the database, or would I be leaving data behind?

 

Also, how exactly should I go about downloading the partially- and non-queryable objects?

 

Thanks!

 

  • February 08, 2011
  • Like
  • 0

Hi...

 

Has anyone implemented serialization of actual Salesforce data (i.e., records/rows returned as SObjects from the Web Services Java API) to XML or JSON?

 

Each such SObject has a getSerializer() method, but does this actually work in a generic way (i.e., so that any SObject records from a Salesforce table can be converted into, say, XML)?

 

I have tried numerous naive techniques (even resorted to JAXB and the Axis website), but nothing seems to do the job, so if there is any working example code, or documentation, I would be grateful.

 

Thanks!

  • January 24, 2011
  • Like
  • 0

Hi...

 

I am trying to figure out whether there is a way of accessing field values after a Web Services Enterprise API query in a generic way, i.e. without having to cast each record to a specific SObject type.

 

Example Java code:

 

 

String queryString = "SELECT Id, Name FROM Account";

SObject[] records = binding.query(queryString).getRecords();

 

 

After successfully executing the query, a number of records (Account rows) are stored in the SObject[] array, so I can get to each record via just walking through the array and reading the corresponding SObject.

 

However, the only for accessing the corresponding field values (e.g., Id, Name above) seems to be via casting, like

 

 

Account account = (Account)records[0];

 

and then invoking the corresponding API methods (e.d., account.getId() to get the value of the ID field.

 

This, however, means that I have to use a different casting for each of the (potentially hundreds) of objects in the Salesforce datastore.

 

The Partner API offers a handy get_any() method that returns Axis MessageElement objects, which encapsulate the actual field values.

 

 

So, is there any way of accomplishing the same in the Enterprise API

 

  • January 22, 2011
  • Like
  • 0

Hi folks...

 

I am trying to get a list of the file attachments associated with an account that I have created in Salesforce.com, but cannot figure out the details. (The attachments are simple text files that have been uploaded via the website and are fully accessible in the corresponding account via any browser.)

 

Using Java and the Web Services API, my code looks like this (listing the essential bits only):

 

SObject[] records = null;

try
{
	records = binding.query("SELECT Id, Name FROM Account").getRecords();
			
	if (records != null)
	{
		System.out.println("Found " + records.length + " records");
	}

	Account account = null;
	QueryResult attachments = null;
					
	for (int i = 0; i < records.length; i++)
	{
		account = (Account)records[i];
		System.out.println(account.getId() + ": " + account.getName());
				
		attachments = account.getAttachments();
				
		System.out.println("Attempt 1: attachments = " + attachments);

		attachments = account.getNotesAndAttachments();
				
		System.out.println("Attempt 2: attachments = " + attachments);
				
		attachments = binding.query("SELECT Id, Name FROM Attachment WHERE ParentId = '" + account.getId() + "'");
		System.out.println("Attempt 3: attachments = " + attachments);
	}				
}
catch (Exception e)
{
}

 

The first query does return several account objects, including the one that holds the attached files (all ending in .txt). However, no attachments are retrieved from any of these account objects.

 

As you can see, I try to get the attachments in 3 different ways, i.e. via calling the getAttachments(), getNotesAndAttachments() and query() methods. The first two always return null, whereas the last returns 0 records found.

 

Obviously I am missing something, so could anyone please enlighten me?

 

Thanks!

  • January 17, 2011
  • Like
  • 0

Hi...

 

Is there any Java programmatic way of retrieving the version of the Salesforce API one uses for their development? There is a getApiVersion() method in the ApexClass of the Enterprise API but I am using the Partner API which does not seem to offer something similar. A PackageVersion class in both the Enterprise and the Partner APIs seems irrelevant to this purpose.

 

Also, is there any Java programmatic way of retrieving the current API version (e.g., say someone uses API v20 and Salesforce has released API v21)?

 

Thanks!

  • February 12, 2011
  • Like
  • 1

Hi...

 

Is there any Java programmatic way of retrieving the version of the Salesforce API one uses for their development? There is a getApiVersion() method in the ApexClass of the Enterprise API but I am using the Partner API which does not seem to offer something similar. A PackageVersion class in both the Enterprise and the Partner APIs seems irrelevant to this purpose.

 

Also, is there any Java programmatic way of retrieving the current API version (e.g., say someone uses API v20 and Salesforce has released API v21)?

 

Thanks!

  • February 12, 2011
  • Like
  • 1

 Hi...

 

I am playing with a test Salesforce database and trying to figure out how to download its contents (i.e., do a full database "dump") into my machines memory, in SObject objects (returned from QueryResult.getRecords()).

 

I am using the Partner API and so far only access the standard Salesforce objects. As far as I can tell, there are 3 categories of those:

 

 

  • Fully queryable (most of them, e.g. Account, Opportunity, Contract, User etc.).
  • Partially queryable, i.e. queryable but restricted by implementation (Vote, UserProfileFeed)
  • Non-queryable (FeedPost, AggregateResult, Name, NoteAndAttachment, ActivityHistory, FeedComment, OpenActivity, EmailStatus, ProcessInstanceHistory)

 

If, in a database with information only stored in standard objects, I download, with appropriate queries, all fully queryable objects, plus somehow (join-like) the remaining few ones (partially- and non-queryable), would that be a the equivalent of the "full dump" of the database, or would I be leaving data behind?

 

Also, how exactly should I go about downloading the partially- and non-queryable objects?

 

Thanks!

 

  • February 08, 2011
  • Like
  • 0

Hi...

 

Has anyone implemented serialization of actual Salesforce data (i.e., records/rows returned as SObjects from the Web Services Java API) to XML or JSON?

 

Each such SObject has a getSerializer() method, but does this actually work in a generic way (i.e., so that any SObject records from a Salesforce table can be converted into, say, XML)?

 

I have tried numerous naive techniques (even resorted to JAXB and the Axis website), but nothing seems to do the job, so if there is any working example code, or documentation, I would be grateful.

 

Thanks!

  • January 24, 2011
  • Like
  • 0

Hi...

 

I am trying to figure out whether there is a way of accessing field values after a Web Services Enterprise API query in a generic way, i.e. without having to cast each record to a specific SObject type.

 

Example Java code:

 

 

String queryString = "SELECT Id, Name FROM Account";

SObject[] records = binding.query(queryString).getRecords();

 

 

After successfully executing the query, a number of records (Account rows) are stored in the SObject[] array, so I can get to each record via just walking through the array and reading the corresponding SObject.

 

However, the only for accessing the corresponding field values (e.g., Id, Name above) seems to be via casting, like

 

 

Account account = (Account)records[0];

 

and then invoking the corresponding API methods (e.d., account.getId() to get the value of the ID field.

 

This, however, means that I have to use a different casting for each of the (potentially hundreds) of objects in the Salesforce datastore.

 

The Partner API offers a handy get_any() method that returns Axis MessageElement objects, which encapsulate the actual field values.

 

 

So, is there any way of accomplishing the same in the Enterprise API

 

  • January 22, 2011
  • Like
  • 0

Hi folks...

 

I am trying to get a list of the file attachments associated with an account that I have created in Salesforce.com, but cannot figure out the details. (The attachments are simple text files that have been uploaded via the website and are fully accessible in the corresponding account via any browser.)

 

Using Java and the Web Services API, my code looks like this (listing the essential bits only):

 

SObject[] records = null;

try
{
	records = binding.query("SELECT Id, Name FROM Account").getRecords();
			
	if (records != null)
	{
		System.out.println("Found " + records.length + " records");
	}

	Account account = null;
	QueryResult attachments = null;
					
	for (int i = 0; i < records.length; i++)
	{
		account = (Account)records[i];
		System.out.println(account.getId() + ": " + account.getName());
				
		attachments = account.getAttachments();
				
		System.out.println("Attempt 1: attachments = " + attachments);

		attachments = account.getNotesAndAttachments();
				
		System.out.println("Attempt 2: attachments = " + attachments);
				
		attachments = binding.query("SELECT Id, Name FROM Attachment WHERE ParentId = '" + account.getId() + "'");
		System.out.println("Attempt 3: attachments = " + attachments);
	}				
}
catch (Exception e)
{
}

 

The first query does return several account objects, including the one that holds the attached files (all ending in .txt). However, no attachments are retrieved from any of these account objects.

 

As you can see, I try to get the attachments in 3 different ways, i.e. via calling the getAttachments(), getNotesAndAttachments() and query() methods. The first two always return null, whereas the last returns 0 records found.

 

Obviously I am missing something, so could anyone please enlighten me?

 

Thanks!

  • January 17, 2011
  • Like
  • 0