Slaesforce FAQ

a task was canceled salesforce api

by Luis Rolfson Published 2 years ago Updated 2 years ago
image

Resolution

There could be multiple reasons for having this error. To find out the error root cause, you may need to analyze a few aspects.

Resolution 2 – Firewall Issues

Please make sure source IP and destination IPs can communicate with each other. Most of the time Firewall issues are the most common reason for the task canceled exception.

Resolution 3 – Do not create multiple HttpClient instances

Do not create multiple HttpClient instances and try to leverage on the static shared instance or use HttpClientfactory.

Resolution 4 – Check Sync and Async calls

As good practice also please make sure to use Sync and Async calls Synchronous and Asynchronous operation properly in the code.

Resolution 5 – Check Dependency for error scenarios

Check if your Http Call has any additional inline dependency and make sure it’s working fine end to end. Any unhandled exception in the call hierarchy component could lead to the BadHttpException or Fault exception.

Cause

When you receive this error in the errors CSV file notice that most of the times this is caused by some custom code being triggered by the task (for example a Trigger) on your Salesforce. This code might be having some error or (usually) taking too much time to finish processing each batch.

Workaround

A possible workaround (and can also be used to validate if this is the cause of your error) is to set the task to run using the Batch API and set the batch size to 1. With such a small batch, your trigger won't reach the timeout and therefore the task will finish successfully (unless the process is not just poorly performant but failing).

Solution

The solution for this issue is to correct the error or improve the performance of the process being triggered. This needs to be done by a Salesforce Administrator and in case of doubts you should contact Salesforce support.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9