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
jloffredojloffredo 

Invalid type on query of custom object in managed package

We have a C# application that works with our managed package. Before we switched to a managed package everything worked fine. Since swithcing to a managed package and adding the namespace in the C# code, it is failing on queries of custom objects with 

 

" INVALID_TYPE: sObject type 'namespace__Client__c' is not supported."

 

The WSDL has been updated.

 

What is confusing to us is the query

 

SELECT namespace__Account_Number__c FROM Accounts

 

works fine.

 

What does not work is 

 

SELECT namespace__Account_Number__c FROM namespace__Client__c

SanjaySSanjayS

If you are not able to query any of the custom objects then looks to me as an access issue.

Check if you have access to query the fields.

 

jloffredojloffredo

 


SanjayS wrote:

If you are not able to query any of the custom objects then looks to me as an access issue.

Check if you have access to query the fields.

 


Checking profiles, all access is granted on the custom objects. So this does not seem to be it.

Don HobsonDon Hobson

I'm not sure that I clearly understand your issue, but i'll try to help based on how I understand it.

 

You might only be using this as an example but I would guess that you are mixing up your object types.

When you access Account or Contacts you are accessing SF objects and they don't have the namespace__ prefix.

 

Salesforce:

Account A = new Account();

 

Custom:

 namespace__MY_Contact__c MC = new namespace__MY_Contact__c();

 

So what appears to be incorrect in your example is this...

 

SELECT namespace__Account_Number__c FROM Accounts <--- Is mixing your prefix type with SF type with no prefix

And even in SF, this is really AccountNumber, not Account_Number__C

 

works fine.

 

What does not work is 

 

SELECT namespace__Account_Number__c FROM namespace__Client__c

 

In this case it is harder to help because I can't see your custom objects. When you go to App Setup, Create, Objects, to look at your custom objects.

 

When you click on one, I assume called Client, you will see the "Custom Object Definition Detail", This has Namespace Prefix: and API Name.

 

Then below that you see "Custom Fields & Relationships", these are the fields you can call in the query. 

 

You can also have salesforce do this for you.

 

Goto https://workbench.developerforce.com/login.php

 

Login: to your Sandbox or Production environment

In the menu at the top: Queries, SOQL Query

 

Select your Object and you will see the fields you can choose. (Not all or shown) You can even build your query right there and copy it into your code.

 

Here is an example I just pulled:

SELECT BillingCity,BillingCountry,BillingPostalCode,BillingState,BillingStreet,Description,Id,Name,NumberOfEmployees,OwnerId,ParentId,Phone,ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet,SicDesc,SystemModstamp,Type,Website FROM Account

 

But if I grabbed one of my custom objects, I get

SELECT namespace__Alert_Asset__c,namespace__Alert_Type__c,namespace__Application__c,namespace__Creation_Time__c,namespace__Description__c,Id,Name FROM namespace__Alert__c

 

 

Don Hobson

ITinvolve