From a5fd7a8c2704f2ad0f9020f273ee52c376867b68 Mon Sep 17 00:00:00 2001 From: Janne Pennanen Date: Thu, 15 Aug 2024 10:20:33 +0300 Subject: [PATCH] changes to getting the errormessage from the API response --- .../Frends.Salesforce.ExecuteQuery/ExecuteQuery.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Frends.Salesforce.ExecuteQuery/Frends.Salesforce.ExecuteQuery/ExecuteQuery.cs b/Frends.Salesforce.ExecuteQuery/Frends.Salesforce.ExecuteQuery/ExecuteQuery.cs index fab1797..69b952b 100644 --- a/Frends.Salesforce.ExecuteQuery/Frends.Salesforce.ExecuteQuery/ExecuteQuery.cs +++ b/Frends.Salesforce.ExecuteQuery/Frends.Salesforce.ExecuteQuery/ExecuteQuery.cs @@ -22,7 +22,7 @@ public class Salesforce /// Information to update the sobject. /// Information about the salesforce destination. /// - /// Object { JObject Body, bool RequestIsSuccessful, Exception ErrorException, string ErrorMessage, string Token } + /// Object { dynamic Body, bool RequestIsSuccessful, Exception ErrorException, string ErrorMessage, string Token } public static async Task ExecuteQuery( [PropertyTab] Input input, [PropertyTab] Options options, @@ -52,12 +52,12 @@ CancellationToken cancellationToken try { var response = await client.ExecuteAsync(request, cancellationToken); - var content = JsonConvert.DeserializeObject(response.Content); + dynamic content = JsonConvert.DeserializeObject(response.Content); if (options.AuthenticationMethod is AuthenticationMethod.OAuth2WithPassword && options.ReturnAccessToken) - return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].message, accessToken); + return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].Value("message"), accessToken); else - return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].message, string.Empty); + return new Result(content, response.IsSuccessful, response.ErrorException, response.IsSuccessful ? string.Empty : content[0].Value("message"), string.Empty); } catch (ArgumentException) {