August 04, 2019

[Solved] Error in Logic app. Status: 403

Hi Folks,

Logic comes a long way for most of the integration thing in Dynamics 365 FO. Its provides a good set of connectors to develop inbound/outbound integration process. While troubleshooting any error is not so easy while it comes to the logic app for new people. I will be sharing some the common error which I faced during development and hopefully, that will helpful for you guys too.

Error: 
"status": 403,
  "message": "{\r\n  \"Message\": \"An error has occurred.\",\r\n  \"ExceptionMessage\": \"Forbidden\",\r\n  \"ExceptionType\": \"System.ServiceModel.Web.WebFaultException`1[[System.ComponentModel.Win32Exception, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=######]]\",\r\n  \"StackTrace\": \"   at Microsoft.Dynamics.Ax.Services.ServicesSessionProvider.ThrowSessionCreationException(ServicesSessionCreationErrorCode exceptionCode)\\r\\n   at Microsoft.Dynamics.Ax.Services.ServicesSessionProvider.GetSession(Boolean isILSession, Boolean bypassAuthentication, String issuer, String company, String language, String partitionKey, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Ax.Services.ServicesSessionManager.InitThreadSession(Boolean ilSession, SessionType sessionType, Boolean bypassAuthentication, String authIssuer, String company, String language, String partitionKey, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.ServicesAosSessionManager.InitializeSession(Boolean bypassAuthentication, String authIssuerThumbprint, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.OwinRequestSessionProvider.CreateSession(ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.ServicesRequestSessionHelper.EnsureRequestSession(IServicesRequestSessionProvider servicesRequestSessionProvider, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.EnsureServicesRequestSessionHandler.EnsureServicesRequestSession(HttpRequestMessage request, IApplicationEnvironment applicationEnvironment)\"\r\n}\r\nclientRequestId: ##########",
  "source": "########Dynamics.cloudax.dynamics.com",

  "errors": []

Possible reason: 
You have used certain users in Logic apps while creating API connections. while that users don't have access to target AX system.

Solution: 
Check the used in target/Source AX system if the user doesn't exist import the same with admin or proper access. If the user exists then check its access.

I will keep posting any error which I faced with a solution that works for me and I hope that may work for you as well. If you are getting other error, put that in the comment section and I will try to find a solution for you.

Cheers!!!
-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta

August 01, 2019

QuickFix-6: How to check if code is running on batch server

If you want to check if the code is running either on the batch or locally, call below method.

1. For sysOperation framework: this.isExecutingInBatch().
2. RunBase batch: this.isInBatch()

both methods will return a boolean.

-Harry Follow us on Facebook to keep in rhythm with us. https:fb.com/theaxapta