2

We've got an issue regarding Salesforce improperly cleaning out FlowElementTestCoverage records, leaving over a million "stranded" on an old/inactive Flow Version. This is causing us to be unable to delete said Flow Version.

The object in question can only be queried/deleted via the Tooling API, and I've written the following just to test retrieval:

HttpRequest req = new HttpRequest();
req.setMethod('GET');
req.setHeader('Authorization','Bearer '+accessToken);

String urlQuery = EncodingUtil.urlEncode('SELECT Id, FlowVersionId FROM FlowElementTestCoverage WHERE FlowVersionId = \'[myFlowVersionId]\' LIMIT 1', 'UTF-8');
req.setEndpoint('https://[domain].my.salesforce.com/services/data/v49.0/tooling/query/?q='+urlQuery);

HttpResponse res = new Http().send(req);
System.debug(res.getStatusCode());
System.debug(res.getStatus());

Problem is, I always get System.CalloutException: Read timed out. However, when I remove the WHERE clause such that the query is SELECT Id, FlowVersionId FROM FlowElementTestCoverage LIMIT 1, it works fine.

I guess I'm just a little lost as to how to proceed. I don't understand how adding a FlowVersionId filter would cause this problem.

1 Answer 1

1

Well, in thinking further about the WHERE clause specifically causing the issue, I wondered if it was a spacing issue. I edited that line to remove spaces in the SELECT and WHERE:

SELECT Id,FlowVersionId FROM FlowElementTestCoverage WHERE FlowVersionId=\'[myFlowVersionId]\' LIMIT 1'

...and it worked!

2
  • White space in the WHERE clause shouldn't be causing a time out exception. Are they correctly URL encoding as %20? Jul 27, 2020 at 18:56
  • @DanielBallinger I just checked and indeed, it is NOT encoding it correctly. Instead, it's doing: SELECT+Id+FROM+FlowElementTestCoverage+WHERE+FlowVersionId+%3D+%27[myFlowVersionId]%27+LIMIT+1
    – Mike
    Jul 27, 2020 at 20:27

You must log in to answer this question.

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