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
FluffyFluffy 

Problems quering certain salesforce tables (???)

Hello,

I use salesforce Perl API and I can execute queries on
most saleforce tables (72 of them). However, there are 8
tables which I cannot query at all. These tables are: Name,
NoteAndAttachment, EmailStatus, OpenActivity,AdditionalNumber,
ProcessInstanceHistory, Approval and ActivityHistory.

When these same tables are queried with Perl API the following error
is generated:

INVALID_TYPE_FOR_OPERATION: entity type does not support query

Its worth pointing out that these entities ARE in the wsdl file,
and they ARE being referenced by other tables, and I CAN call
describe() on them from the API, and all the correct fields and their
types are returned..

So, does anybody have any ideas why do these tables not support
queries ? And what could I possibly do to debug this matter ?

Thanks ahead for any suggestions,


--Fluffy

PS. Apologies for cross-posting
Alex 2.0Alex 2.0
Hi Fluffy (ehr...that sounds a little weird...)

Can you post the exact soql query?


Thanks,

--Alex
FluffyFluffy
Hi Alex
thanks for your response. The queries I'm running are as basic as they get.
For instance "Select Id from Name". I wonder whether it has anything to do with
permissions over these particular salesforce objects...??? Becuase I'm downloading
all our saleforce data and replicating it in a postgresql db, it would be nice to know
how to programmatically find out whether I have permissions over these "special" tables...

--Fluffy
wintamutewintamute
Hi Fluffy,

you can only query Salesforce Objects (like Accounts, Contacts, custom Objects). Each of those objects has a Name field.
So a valid query would be "Select Id from Accounts where Name = foo", you cannot directly query for a name since there is no Name object (table).
You should check the api reference for all standard objects with all fields and also sample queries.
Api reference

Best,
Andreas
Alex 2.0Alex 2.0
Fluffy,


it definetly sounds like a permission issue. Can you log into salesforce and check the API user permissions under Setup? (If you can edit/see those objects within salesforce, the same user should be able to see them through the API if the API User checkbox is checked under that user's profile)

wintamutewintamute
Hi Fluffy,

I stand corrected, there is a "Name" table, along with the other tables you listed. Most of these tables don't support the query call though, that explains the error message you get.
You should check the api reference for each of those objects which calls are supported for that object.
For instance the Name object cannot be directly queried, but can be used with describeSObject. Further information on objects like Name can be found in the api reference along with how to use them in (indirect) queries.
Some of the objects you listed do support the query call, so there it could be a permission problem too. But then the error message should be different.

So that explains part of your problem.
Sorry for my previos misleading post, I should think first before posting ;)

Andreas
Lawrence-CECLawrence-CEC

Any solution to this issue? We are trying to migrate from an old org to a new org and haven't found a way to pull over data from tables such as the EmailStatus table.

 

---Lawrence

 

CRM-CrackerCRM-Cracker

If you need activity in opportunity pass the value of opportunity ID and you will get the list of activity for the same.

In that way you can view the history of standard ojbect and custom as well.

This is code in C#. I have written in PERL/PHP as well I will post later.

      

private void OpportunityActivity(String strOppId)
        {

            QueryResult qr = null;
            binding.QueryOptionsValue = new QueryOptions();
            binding.QueryOptionsValue.batchSize = 250;
            binding.QueryOptionsValue.batchSizeSpecified = true;
            String OwnerName = "";
            try
            {

                qr = binding.query("SELECT Id,(SELECT ActivityDate, Description FROM ActivityHistories) FROM Opportunity Where Id='" + strOppId + "'");
               
                for (int i = 0; i < qr.records.Length;  i++)
                {
                    Opportunity con = (Opportunity)qr.records[i];
                    ActivityHistory act = (ActivityHistory) con.ActivityHistories.records[i];
                    String StrDescription = act.Description;
                    DateTime activityDate = (DateTime)act.ActivityDate;
                    Response.Write("<BR>" + con.Id + "Activity Date:" + activityDate + "-Description is:" + StrDescription);
                }
            }
            catch (Exception Ex)
            {
                Response.Write("Owner ID Missinsg for this Lead" + Ex.Message.ToString());
                Response.End();
            }

I believe it helps in the integration with Salesforce to salesforce cummunity.

-Mahendra Singh MBM Eng.Jodhpur