Salesforce Application Scope Issue - Session Expired or Invalid Connection

Hi All,

We are working on an automation wherein we are using Salesforce Connector to query and update the records in Salesforce.

Below are the steps we have implemented. Please let us know if its implemented as per best practices or it needs any modifications as per best practices or standards.

We have made 2 solutions

  1. Within Salesforce Application Scope added a For loop to process records and at the end we have made connection.disconnect still we are seeing intermittently connection invalid issue after which we need to open the solution in studio on the VM and manually do the test connection for Salesforce application scope and save the solution without publishing and then run the process from Orchestrator it will work as expected for certain time period again it will run into same issue and need to follow the same step to manually test the connection.

  2. For loop is outside and within the For loop added the Sales force application scope and after each record of for loop added to disconnect the connection but still it gives the same issue of session expired or connection invalid after sometime and need to test the connection manually and save the solution and again it will run for certain time.

Is there any configuration needs to be done at Salesforce end so the connection last for longer time period or are there any limitation for the no of API call can be make from UiPath to Salesforce.

As a best practice which solution is preferred from the above mention solutions (1 or 2). Also how to dispose the connection so next time when process is run or for next record it can reset the connection and do the required steps As-Is without manually Test the connection at regular interval.

Chintan Salvi

Hello @chintansalvi!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly

Hi Chintan,

From what I have seen is we cannot use the salesforce connection more than 2 times. It gives an session timeout exception. So it automatically disconnects after 2 calls

Hi Rohan,

Thank you for response.

In my case I have to update multiple records in Salesforce for which I need to loop through list of records and update and this process runs every 5 mins.

One thing we notice is sometime for 2-3 consecutive runs the records will be process as expected in respective run and after that it will start failing with connection issue. Then we have to goto VM and open the solution and re-test the connection thereafter it works fine for next 2-3 runs and same issue occur again.


Hi Chintan,

Not sure if you have resolved this issue. The Salesforce activity scope has a tendency to expire or throw invalid session ID while exiting the Application scope. What you can do is keeping the FOREACH loop within the Application scope and having a Try catch around the application scope to handle the exception while exiting the Application scope.


1 Like

Hi Rishi,

Thank You for the response.

We did tried to put the For Loop within the application scope too but still we were facing the similar issue back in time when we were working on our process automation. Since it was one time automation and required to clear the backlog we had a workaround in place at that time to reset the connection manually at regular interval of time to keep the automation up and running and didn’t research more on it later. But we hope the things might have improved and might be useful for future process automation w.r.t Salesforce.

Chintan Salvi