1

I'm trying to get a fullName field of a CustomObject in query

QueryResult queryResult = toolingConnection.query("select TableEnumOrId, FullName, LastModifiedDate from CustomField " );

I have two developer edition accounts. In the first it works, in the second I get Invalid cross reference id. When I remove fullName from query, it works.

The code is absolutely the same in both cases, I change only credentials.

Here is the full error message:

[UnexpectedErrorFault [ApiFault exceptionCode='INVALID_CROSS_REFERENCE_KEY' exceptionMessage='invalid cross reference id' upgradeURL='null' upgradeMessage='null' ] ]

What could be the reason?

And what does this exception generally mean?

5
  • Can you provide more details of the error (full message) as well as more context around the code? I do not see in your code where you are setting or filtering by ID. The error means you are setting or filtering by an ID that is not an ID of the object type you are querying / filtering on
    – Eric
    Commented Dec 5, 2014 at 2:06
  • I've just updated my question and now it contains full error message. The problem is that I'm NOT setting or filtering by ID. I've provided the full text of my query (I did copy-paste). Before that call the only thing I do is create toolingConnection. Commented Dec 5, 2014 at 2:15
  • Stumped as the definition of the error is: "An invalid foreign key can't be set on a field. For example, if an object share such as AccountShare can't be deleted because the share row is a result of a sharing rule" So if you are not setting an ID then there should be no reason to throw the error. Are you sure the error occurs due to that query? Also, what enviroment are you developing in?
    – Eric
    Commented Dec 5, 2014 at 2:30
  • I am curious if the application is adding to the query you posted. Typically you see a space after the last part of the query like you have - CustomField " - when there is a concatenation going to happen
    – Eric
    Commented Dec 5, 2014 at 2:34
  • I'm developing in the Developer Edition environment, Java. Yes, I'm sure because 1) the same line of code works when I remove fullName 2) the same line of code works when I login to the other Developer Edition account. You can see that space because the where clause is supposed to be (I would like to do "where lastModifiedDate > ...") but I removed this part when I found out that problem. Commented Dec 5, 2014 at 2:50

1 Answer 1

1

Ok I believe I have found the cause:

When it hits a field with __del it provides the error

Data_Quality_Description_del

caused the error

Although I have other field that came in the query with the _del suffix I think it may be because the field AND the object were both deleted?

Although when I was able to reproduce the error, I cannot say for sure what caused it because I cannot find the field in the org.

I would still open a case with Salesforce to see if they can resolve the issue because it is a BUG

4
  • Yes, it could be, because the first one is emea and the second one is eu2 if I'm not mistaking. So it seems that I have to omit query fullName( Commented Dec 5, 2014 at 3:31
  • I know about developerName field but I need to get a name of a SObject that contains modified field. I know also about the field TableEnumOrId but in that case I need to distinguish ID and Enum somehow. I thought that ID can have only digit at the first position but it seems that it doesn't Commented Dec 5, 2014 at 3:35
  • Oh I think you are right. I was trying to trace my deleted fields using that query( Thank you! Commented Dec 5, 2014 at 3:41
  • > I would still open a case with Salesforce to see if they can resolve the issue because it is a BUG. - I can't do this, I have only Developer Edition Account Commented Dec 5, 2014 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .