2

I'm writing a software in C# that need to pull all the information about the users in Salesforce (Id, Username, all other attributes).

I want to use the Bulk API and think my query should be:

SELECT AboutMe,AccountId,Address,Alias,BadgeText,BannerPhotoUrl,CallCenterId,City,CommunityNickname,CompanyName,ContactId,Country,CreatedById,CreatedDate,DefaultGroupNotificationFrequency,DelegatedApproverId,Department,DigestFrequency,Division,Email,EmailEncodingKey,EmailPreferencesAutoBcc,EmailPreferencesAutoBccStayInTouch,EmailPreferencesStayInTouchReminder,EmployeeNumber,Extension,Fax,FederationIdentifier,FirstName,ForecastEnabled,FullPhotoUrl,GeocodeAccuracy,Id,IsActive,IsProfilePhotoActive,JigsawImportLimitOverride,LanguageLocaleKey,LastLoginDate,LastModifiedById,LastModifiedDate,LastName,LastPasswordChangeDate,LastReferencedDate,LastViewedDate,Latitude,LocaleSidKey,Longitude,ManagerId,MediumPhotoUrl,MobilePhone,Name,OfflinePdaTrialExpirationDate,OfflineTrialExpirationDate,Phone,PostalCode,ProfileId,ReceivesAdminInfoEmails,ReceivesInfoEmails,SenderEmail,SenderName,Signature,SmallPhotoUrl,State,StayInTouchNote,StayInTouchSignature,StayInTouchSubject,Street,SystemModstamp,TimeZoneSidKey,Title,Username,UserPermissionsCallCenterAutoLogin,UserPermissionsInteractionUser,UserPermissionsJigsawProspectingUser,UserPermissionsKnowledgeUser,UserPermissionsMarketingUser,UserPermissionsMobileUser,UserPermissionsOfflineUser,UserPermissionsSFContentUser,UserPermissionsSiteforceContributorUser,UserPermissionsSiteforcePublisherUser,UserPermissionsSupportUser,UserPermissionsWorkDotComUserFeature,UserPreferencesActivityRemindersPopup,UserPreferencesApexPagesDeveloperMode,UserPreferencesCacheDiagnostics,UserPreferencesContentEmailAsAndWhen,UserPreferencesContentNoEmail,UserPreferencesDisableAllFeedsEmail,UserPreferencesDisableBookmarkEmail,UserPreferencesDisableChangeCommentEmail,UserPreferencesDisableEndorsementEmail,UserPreferencesDisableFeedbackEmail,UserPreferencesDisableFileShareNotificationsForApi,UserPreferencesDisableFollowersEmail,UserPreferencesDisableLaterCommentEmail,UserPreferencesDisableLikeEmail,UserPreferencesDisableMentionsPostEmail,UserPreferencesDisableMessageEmail,UserPreferencesDisableProfilePostEmail,UserPreferencesDisableSharePostEmail,UserPreferencesDisableWorkEmail,UserPreferencesDisCommentAfterLikeEmail,UserPreferencesDisMentionsCommentEmail,UserPreferencesDisProfPostCommentEmail,UserPreferencesEnableAutoSubForFeeds,UserPreferencesEventRemindersCheckboxDefault,UserPreferencesHideBiggerPhotoCallout,UserPreferencesHideChatterOnboardingSplash,UserPreferencesHideCSNDesktopTask,UserPreferencesHideCSNGetChatterMobileTask,UserPreferencesHideEndUserOnboardingAssistantModal,UserPreferencesHideLightningMigrationModal,UserPreferencesHideS1BrowserUI,UserPreferencesHideSecondChatterOnboardingSplash,UserPreferencesHideSfxWelcomeMat,UserPreferencesJigsawListUser,UserPreferencesLightningExperiencePreferred,UserPreferencesPathAssistantCollapsed,UserPreferencesPreviewLightning,UserPreferencesReminderSoundOff,UserPreferencesShowCityToExternalUsers,UserPreferencesShowCityToGuestUsers,UserPreferencesShowCountryToExternalUsers,UserPreferencesShowCountryToGuestUsers,UserPreferencesShowEmailToExternalUsers,UserPreferencesShowEmailToGuestUsers,UserPreferencesShowFaxToExternalUsers,UserPreferencesShowFaxToGuestUsers,UserPreferencesShowManagerToExternalUsers,UserPreferencesShowManagerToGuestUsers,UserPreferencesShowMobilePhoneToExternalUsers,UserPreferencesShowMobilePhoneToGuestUsers,UserPreferencesShowPostalCodeToExternalUsers,UserPreferencesShowPostalCodeToGuestUsers,UserPreferencesShowProfilePicToGuestUsers,UserPreferencesShowStateToExternalUsers,UserPreferencesShowStateToGuestUsers,UserPreferencesShowStreetAddressToExternalUsers,UserPreferencesShowStreetAddressToGuestUsers,UserPreferencesShowTitleToExternalUsers,UserPreferencesShowTitleToGuestUsers,UserPreferencesShowWorkPhoneToExternalUsers,UserPreferencesShowWorkPhoneToGuestUsers,UserPreferencesSortFeedByComment,UserPreferencesTaskRemindersCheckboxDefault,UserRoleId,UserType FROM User

For some reason, i'm getting the following error for my batch:

stateMessage=InvalidBatch : Failed to process query: FUNCTIONALITY_NOT_ENABLED: Selecting compound data not supported in Bulk Query

Any ideas how to solve this problem?

My software is working with simple query (like ‘select Username from user’).

2 Answers 2

2

If you want your query to work independent of version, query the fields individually. If you want to query the compound fields, make sure you are using the most recent API Version. As @Eric notes, the Bulk API does not support this behavior at any level, so you need to query the individual fields for it to work no matter what.

Querying the individual fields would look like:

SELECT City, Street, State, PostalCode, Country FROM User

Reference

Address Compound Fields:

Standard addresses—addresses built into standard objects in Salesforce—are accessible in the SOAP and REST APIs as an Address, a structured compound data type, as well as individual address elements.

Using API 30.0 and later, standard addresses are available in the SOAP and REST APIs as a compound field of type Address, a structured data type that combines the following fields.

  • Accuracy
  • City
  • Country
  • CountryCode
  • Latitude
  • Longitude
  • PostalCode
  • State
  • StateCode
  • Street

Retrieving Compound Address Fields

Using compound fields can simplify code that works with addresses, especially for SOQL queries. SOQL SELECT clauses can reference addresses directly, instead of all of the individual component fields.

SELECT Name, BillingAddress
FROM Account

To write code that’s compatible with API versions before 30.0, as well as API 30.0 and above, use the individual fields:

SELECT Name, BillingStreet, BillingCity, BillingState, BillingPostalCode,
       BillingCountry, BillingLatitude, BillingLongitude
FROM Account
7
  • OP is asking about the bulk API. I do not believe this is supported yet via the bulk API
    – Eric
    Commented Aug 15, 2016 at 15:36
  • @Eric I am surprised the documentation on compound fields seems to ignore that issue. But still, the point is that they need to be queried individually.
    – Adrian Larson
    Commented Aug 15, 2016 at 15:39
  • Eric & Adrian, thank you for your answers!!! About my second question - I need to support large organizations with alot of users. Bulk is the sutible API for my mission? do i need to use PK Chunking?
    – user34147
    Commented Aug 15, 2016 at 15:48
  • How many users are you dealing with? If it's less than 10k I think just standard REST is fine honestly.
    – Adrian Larson
    Commented Aug 15, 2016 at 15:49
  • 1
    Done: salesforce.stackexchange.com/questions/136860/…
    – user34147
    Commented Aug 15, 2016 at 16:49
1

The error comes from the field "Address". Querying for that field when using the bulk API is not supported

You need to select the individual parts of the address

i.e. City, Street

https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/asynch_api_using_bulk_query.htm

Also, Bulk API can’t access or query compound address or compound geolocation fields.

1
  • You'd think that should be listed here as well. I've submitted feedback on the document that it's missing that point.
    – Adrian Larson
    Commented Aug 15, 2016 at 15:46

You must log in to answer this question.

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