Salesforce Asked on January 4, 2022
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.
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!
Answered by Mike on January 4, 2022
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP