0

This is a bit of an unusual one. I'v generated Apex classes using WSDL2Apex in Salesforce itself, using Salesforce's Tooling API WSDL file (had to modify it a bit - there's no ANY type in SF).

Then I wrote this little class:

public with sharing class SoapListViewDescribe {
    public static void getOne(String view, String sobjectString){
        toolingSoapSforceCom.DescribeSoqlListViewParams params = new toolingSoapSforceCom.DescribeSoqlListViewParams();
        params.developerNameOrId = view;
        params.sobjectType = sobjectString;
        toolingSoapSforceCom.DescribeSoqlListViewsRequest request = new toolingSoapSforceCom.DescribeSoqlListViewsRequest();
        request.listViewParams = new toolingSoapSforceCom.DescribeSoqlListViewParams[]{ params };
        toolingSoapSforceCom.SforceService service = new toolingSoapSforceCom.SforceService();
        service.SessionHeader = new toolingSoapSforceCom.SessionHeader_element();
        service.SessionHeader.sessionId = 'someSID';
        service.CallOptions = new toolingSoapSforceCom.CallOptions_element();
        service.CallOptions.client = 'ournamespace/ournamespace/';
        service.timeout_x = 60 * 1000;
        service.endpoint_x = Url.getOrgDomainUrl().toExternalForm() + '/services/Soap/T/45.0';
        toolingSoapSforceCom.DescribeSoqlListViewResult resp = service.describeSoqlListViews(request);
        System.debug(resp);
    }
}

When called upon Lead object I get error (either by view name or Id):

INVALID_TYPE: sObject type 'Lead' is not supported in describeSoqlListViews.

When called on our custom object, I get error:

INVALID_CROSS_REFERENCE_KEY: invalid cross reference id

When called on custom object by view Id

UNKNOWN_EXCEPTION: List view not found.

  • Solved it myself. Turns out I needed to use executeListView. – dzh Mar 20 at 11:13
  • Want to post your own answer so folks can identify it as solved? – David Reed Mar 20 at 11:30
0

To answer myself, I needed to use executeListView method instead of describe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.