I’m getting an intermittent error (happens every 2nd transaction for example) running an Unattended Bot that contains a Salesforce Application Scope.
The Scope Response returns as False and is producing the following exception message: Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path ‘’, line 0, position 0. at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json) at UiPathTeam.Salesforce.ExtensionPackage.Salesforce_Application_Scope.Execute(NativeActivityContext context), Salesforce Response Service: Error: Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Path ‘’, line 0, position 0. at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json) at UiPathTeam.Salesforce.ExtensionPackage.Salesforce_Application_Scope.Execute(NativeActivityContext context)
I’m passing the Username and Consumer Key in as String variables.
Additionally, I’m passing in the Password and Consumer Secret as Secure String variables.
The End Scope Decision is set to “Close_at_scope_end” and Environment/Server Types are both set as “Production”
When the activity fails, I am catching it, delaying for 10 seconds and retrying. However, the issue does not resolve upon retry.
Would anyone have any ideas or feedback on how to resolve this?
The Scope worked fine locally on my own laptop and initially was fine on the VM’s for the unattended bot. However, it is now failing.
Hi @Cristian_Negulescu, would you be able to provide any feedback or assistance here?
I appreciate you may be busy but would love to get this issue resolved. Thank you very much
Hello Billy,
I don’t remember having this type of issue and I never modify the code of my package from September 2020 and I will never modify the package again.
The best option is RAW REST API commands I have a lot of videos here:
and they’re a lot more on my Youtube channel.
OK, now back to your issue all variables look but from what I remember that with some salesforce servers in Production you can have some limitations.
The limitation is that this server will allow 5 or 10 at the same time connection. The server will cancel deallocate the connection after 1 hour from the first connection.
Because of this logic of the server, I develop the Connection_Status Properties, and in this case, Close_at_scope_end means this I send new Uri(RespServiceURL + "/services/oauth2/revoke?token=" + RespAuthToken) So Revoke with initial Token.
So somehow your Robot is not arriving at the end of the Application Scope and this will not Revoke the Token and this will consume this on the server and you arrive at the limitation. Rember the server will automatically close the connection after 1 hour.
Recommendation:
- please optimize your robot to do multiple operations in one application scope
- don't start multiple robots that work with salesforce in parallel because servers has some limitation
- if you have a single robot that is working with salesforce try to run it 3 times in 1 hour and group everything in the queue, instead run the robot 20 times in 1 hour.
this appears to be the solution I am looking for - I’ll work on this and will let you know if this resolved my issue (Apologies for the late reply, really appreciate your in-depth explanation).