1

I have configured a Salesforce Connect relationship to an external data source using a custom Apex adapter. I am trying to configure one of the external objects to allow search.

I have selected the "Allow Search" checkbox on the external object and have created a tab for the external object. The profile I'm using has read access for the object.

Firstly, the external object is not appearing in the available objects for results.

Secondly, when I run a SOSL query against the external object in the developer console, I receive the error entity type <External Object> does not support search. Do I need to do anything beyond checking "Allow Search" on the external object?

Additionally, when I navigate to the external data source and select "Validate and Sync", the "Allow Search" setting stays checked. When I then click "Sync", the external object has the "Allow Search" setting unchecked. I am not seeing anythng in the documentation for DataSource.Table or DataSource.Column that allows for explicitly specifying that an external object should allow search. In my DataSource.Connection class, I have a search method defined.

For reference:

DataSource.Table documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_DataSource_Table.htm

DataSource.Column documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_DataSource_Column.htm#apex_class_DataSource_Column

2 Answers 2

2

Did You enable it to external Data Source as well?

To include an external object in SOSL and Salesforce searches, enable search on both the external object and the external data source.

https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_limits_external_objects.htm

2
  • Right now, since I'm using a custom Apex adapter, I'm simply doing a custom callout within the search method and parsing the response, so yes it should be supported. Of course unless something else is needed here that I'm not aware of.
    – moth
    Mar 27, 2018 at 21:02
  • To be clear as well, the search method is implemented similarly to this Salesforce documentation: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – moth
    Mar 27, 2018 at 21:10
1

I found my error and resolved it.

I was missing the appropriate "Capability Enum" (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_enum_DataSource_Capability.htm) value in the getCapabilities() method in my DataSource.Provider.

So I went from

override global List<DataSource.Capability> getCapabilities() {
    List<DataSource.Capability> capabilities = new List<DataSource.Capability>();
    capabilities.add(DataSource.Capability.ROW_QUERY);
    capabilities.add(DataSource.Capability.REQUIRE_ENDPOINT);
    return capabilities;
}

to

override global List<DataSource.Capability> getCapabilities() {
    List<DataSource.Capability> capabilities = new List<DataSource.Capability>();
    capabilities.add(DataSource.Capability.ROW_QUERY);
    capabilities.add(DataSource.Capability.SEARCH);
    capabilities.add(DataSource.Capability.REQUIRE_ENDPOINT);
    return capabilities;
}

To round out what I learned here, the "Validate and Sync" button runs the Apex from the DataSource.Connection sync() method, while clicking the "Sync" button subsequently runs at least the Apex in the DataSource.Provider getCapabilities() method.

You must log in to answer this question.

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