Jump to content

Exceptions: Difference between revisions

From Resco's Wiki
Line 146: Line 146:


In this case, we could not explain the problem, but at least we were able to describe it.
In this case, we could not explain the problem, but at least we were able to describe it.
=== Insufficient privileges ===
Here is another example (taken from the online log):
<syntaxhighlight lang="xml">
OnlineError 2020-09-14T23:37:36.6485490+05:30
Called from: DynamicEntityForm`1.SaveAsyncCompleted(MobileCrm.Controllers.Common.AccountForm)
Net.RescoSoapException: Server Error: {"CallerPrincipal":{"PrincipalId":"4f0d247e-019c-e811-a96c-000d3aa30ac8","Type":8,"IsUserPrincipal":true},"OwnerPrincipal":{"PrincipalId":"00000000-0000-0000-0000-000000000000","Type":8,"IsUserPrincipal":true},"ObjectId":"fdf21d78-019c-e811-a96c-000d3aa30ac8","ObjectTypeCode":8,"EntityName":"systemuser","ObjectBusinessUnitId":"64160e70-ca11-ea11-a811-000d3a085b2b","RightsToCheck":"AppendToAccess","RoleAccessRights":"None","PoaAccessRights":"None","HsmAccessRights":"None","GrantedAccessRights":"None","Messages":["PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False","EntityUserGroupRights = None","MinimumPrivilegeDepthRequired = Global","SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0"],"EntityOwnershipTypeMask":4,"CallerInfo":{"IsSystemUser":false,"IsSupportUser":false,"IsAdministrator":false,"IsCustomizer":false,"IsDisabled":false,"IsIntegrationUser":false,"Teams":null,"Roles":null},"ReadOnlyState":"UserAndOrgFullAccess","IsHsmEnabled":false,"HsmInfo":null}
<soap>Code.Value=s:Sender| Detail.OrganizationServiceFault.ActivityId=605735e2-db46-4b69-89fa-fb1184e8fce2| Detail.OrganizationServiceFault.ErrorCode=-2147187962| Detail.OrganizationServiceFault.HelpLink=http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80048306&client=platform| Detail.OrganizationServiceFault.Timestamp=2020-09-14T18:07:36.4953731Z| Detail.OrganizationServiceFault.ExceptionRetriable=false</soap>
  at WebServiceBase.ThrowSoapException (Net.HttpException ex) [0x00043] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at WebServiceBase+XmlResponse..ctor (Object context, Boolean soap, WebServiceBase webService, Xml.XmlReaderSettings xmlSettings, Boolean processMultipartResponses) [0x00068] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at WebServiceBase.InternalEndInvoke (Object request, Func`2[T,TResult] readResponse) [0x00007] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at WebServiceBase.Invoke (String action, Object args, Action`2[T1,T2] writeRequest, Action`1[T] writeHeader, Func`2[T,TResult] readResponse) [0x0000c] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at WebServiceBase.Invoke (String action, Object args, Action`2[T1,T2] writeRequest, Func`2[T,TResult] readResponse) [0x0000a] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at Crm2011.CrmService2011.InternalExecuteRequest (Crm2011.InternalRequest request) [0x0002d] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at Crm2011.CrmService2011.ExecuteRequest (Object request) [0x00007] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at MobileCrm.Data.Online.SaveRequest.SendEntityInternal (ICrmService service, MobileCrm.Data.DynamicEntity record) [0x0000c] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at MobileCrm.Data.Online.SaveRequest.SendEntity (ICrmService service, MobileCrm.Data.DynamicEntity entity, Boolean recursive) [0x00045] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at MobileCrm.Data.Online.SaveRequest.Execute (ICrmService service) [0x00013] in <50637abbe03e41ca9d84f19a186fc0d1>:0
  at MobileCrm.Data.Online.OnlineRepository.RequestThread () [0x000eb] in <50637abbe03e41ca9d84f19a186fc0d1>:0
</syntaxhighlight>
After the simplification:
<syntaxhighlight lang="xml">
OnlineError 2020-09-14T23:37:36.6485490+05:30
Called from: DynamicEntityForm.SaveAsyncCompleted(AccountForm)
RescoSoapException: Server Error: {"CallerPrincipal":{"PrincipalId":"4f0d247e-019c-e811-a96c-000d3aa30ac8","Type":8,"IsUserPrincipal":true},"OwnerPrincipal":{"PrincipalId":"00000000-0000-0000-0000-000000000000","Type":8,"IsUserPrincipal":true},"ObjectId":"fdf21d78-019c-e811-a96c-000d3aa30ac8","ObjectTypeCode":8,"EntityName":"systemuser","ObjectBusinessUnitId":"64160e70-ca11-ea11-a811-000d3a085b2b","RightsToCheck":"AppendToAccess","RoleAccessRights":"None","PoaAccessRights":"None","HsmAccessRights":"None","GrantedAccessRights":"None","Messages":["PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False","EntityUserGroupRights = None","MinimumPrivilegeDepthRequired = Global","SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0"],"EntityOwnershipTypeMask":4,"CallerInfo":{"IsSystemUser":false,"IsSupportUser":false,"IsAdministrator":false,"IsCustomizer":false,"IsDisabled":false,"IsIntegrationUser":false,"Teams":null,"Roles":null},"ReadOnlyState":"UserAndOrgFullAccess","IsHsmEnabled":false,"HsmInfo":null}
<soap>Code.Value=s:Sender| Detail.OrganizationServiceFault.ActivityId=605735e2-db46-4b69-89fa-fb1184e8fce2| Detail.OrganizationServiceFault.ErrorCode=-2147187962| Detail.OrganizationServiceFault.HelpLink=http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80048306&client=platform| Detail.OrganizationServiceFault.Timestamp=2020-09-14T18:07:36.4953731Z| Detail.OrganizationServiceFault.ExceptionRetriable=false</soap>
  at WebServiceBase+XmlResponse..ctor ()
  at WebServiceBase.Invoke ()
  at Crm2011.CrmService2011.ExecuteRequest ()
  at MobileCrm.Data.Online.SaveRequest.SendEntity ()
  at MobileCrm.Data.Online.SaveRequest.Execute ()
  at MobileCrm.Data.Online.OnlineRepository.RequestThread ()
</syntaxhighlight>
The first conclusion is that the problem happened when saving (because of "SaveRequest") an account (because of "AccountForm") to the (Dynamics) server.
We also see that server responded with some error message. Let's try to extract some useful info out of it.
The main error message is here:
<syntaxhighlight lang="xml">
{"CallerPrincipal":{"PrincipalId":"4f0d247e-019c-e811-a96c-000d3aa30ac8","Type":8,"IsUserPrincipal":true},"OwnerPrincipal":{"PrincipalId":"00000000-0000-0000-0000-000000000000","Type":8,"IsUserPrincipal":true},"ObjectId":"fdf21d78-019c-e811-a96c-000d3aa30ac8","ObjectTypeCode":8,"EntityName":"systemuser","ObjectBusinessUnitId":"64160e70-ca11-ea11-a811-000d3a085b2b","RightsToCheck":"AppendToAccess","RoleAccessRights":"None","PoaAccessRights":"None","HsmAccessRights":"None","GrantedAccessRights":"None","Messages":["PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False","EntityUserGroupRights = None","MinimumPrivilegeDepthRequired = Global","SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0"],"EntityOwnershipTypeMask":4,"CallerInfo":{"IsSystemUser":false,"IsSupportUser":false,"IsAdministrator":false,"IsCustomizer":false,"IsDisabled":false,"IsIntegrationUser":false,"Teams":null,"Roles":null},"ReadOnlyState":"UserAndOrgFullAccess","IsHsmEnabled":false,"HsmInfo":null}
</syntaxhighlight>
Note that the message uses JSON formatting, which uses to be explained as a property bag. It means a set of properties with their values; values can be strings, numbers, or more complex objects:
* Array (enclosed in [])
* Another property bag (enclosed in {})
Let's format our error to make it more readable:
<syntaxhighlight lang="json">
CallerPrincipal : {PrincipalId:"4f0d247e-019c-e811-a96c-000d3aa30ac8", Type:8, IsUserPrincipal:true},
OwnerPrincipal : {PrincipalId:"00000000-0000-0000-0000-000000000000", Type:8, IsUserPrincipal:true},
ObjectId : "fdf21d78-019c-e811-a96c-000d3aa30ac8",
ObjectTypeCode : 8,
EntityName : systemuser,
ObjectBusinessUnitId : "64160e70-ca11-ea11-a811-000d3a085b2b",
RightsToCheck : AppendToAccess,
RoleAccessRights : None,
PoaAccessRights : None,
HsmAccessRights : None,
GrantedAccessRights : None,
Messages:[
  PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False,
  EntityUserGroupRights = None,
  MinimumPrivilegeDepthRequired = Global,
  SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0
],
EntityOwnershipTypeMask : 4,
CallerInfo : {IsSystemUser:false, IsSupportUser:false, IsAdministrator:false, IsCustomizer:false, IsDisabled:false, IsIntegrationUser:false, Teams:null, Roles:null},
ReadOnlyState : UserAndOrgFullAccess,
IsHsmEnabled : false,
HsmInfo : null
</syntaxhighlight>
The above text should be interpreted by a Dynamics expert, but we can draw some conclusions, too.
* The term principal refers to users or teams, i.e. to subjects that can be assigned security roles (and thus access permissions).
* The concerned entity is systemuser (8 is its typecode). We see also the ID of systemuser record, but we can't use this information right now.
* As next we see several statements related to access rights. Here is some background info: Role refers to user access rights, POA refers to sharing, HSM probably to hierarchical security, etc. AppendToAccess refers to the access right defined as "The right to append another record to the specified object." In all cases we see "None" which seems to indicate insufficient privileges.
Additional details of the server response are listed between the tags <soap>...</soap>. Most of them seem to be useless, but we could at least try to decipher ErrorCode=-2147187962.
I used Google and out of many results selected this advice: "Can you check what permissions you have for the AppendTo privilege for your custom entity. Also, check that the systemuser entity has append and appendto privileges for the role that you are testing with."
Conclusion: Looks like our mobile user has insufficient privileges to execute the attempted operation. Ask the server admin for help.


=== Example 2 ===
=== Example 2 ===

Revision as of 06:42, 19 October 2020

Warning Work in progress! We are in the process of updating the information on this page. Subject to change.

This article is designed for technical support providers responsible for helping users of Resco mobile apps who are in charge of analyzing log files and who want to understand better some of the exceptions included in the logs.

What is an exception?

An exception is a programming construct usually describing an error. Unlike simple errors which are represented by a string, exceptions bear more information:

  • The exception name often gives semantic information about the kind of problem encountered. E.g., WebException refers to a problem in web communication.
  • The message is the string describing the problem.
  • The StackTrace (also known as the call stack) is the information for the programmer showing a sequence of calls that lead to the problem.
  • InnerException (if any) refers to a chained (wrapped) exception.

Here are some of the common exceptions you may encounter:

  • Exception - general exception, no additional information available
  • SqliteException refers to a database problem (SQLite is the database engine used by Resco mobile apps)
  • MobileCrm.Data.Google.UnauthorizedException refers to an authorization problem, probably related to some Google service
  • WebException and WebRequestException refer to a web communication problem.
  • HttpException refers to an HTTP communication problem (Resco mobile apps use the HTTP protocol to communicate with various servers)
  • Java.IO.IOException: Low-level Android exception related to input/output operation. Usually wrapped into a more general exception.
  • SyncDownloadException reports sync downloader problem.

Some exceptions clearly indicate a programming bug, for example:

  • NullReferenceException - using a null pointer without proper check
  • InvalidOperationException - some operation was attempted without checking the context, argument, etc.
  • ArgumentOutOfRangeException - some parameter was submitted without checking the allowed range

There are many more exceptions thrown either by the operating system (actually .Net) or by Resco Mobile CRM itself. There is no point in learning them. All you need to realize is that the name may give you some hint.

Two important exceptions

These two Resco Mobile CRM exceptions deserve more attention: RescoSoapException and UserAbortException.

RescoSoapException

Resco uses this exception to denote server error response in a format understood by Resco mobile apps. (Actually, an HTTP error 500 containing SOAP error response, that's why the exception name.)

What is specific about this exception is that it contains selected details from the server error response.

These details are listed under <soap> tag, for example

<soap>"error" : "invalid_grant", "error_description" : "Token has been expired or revoked."</soap>

You should read them as

error = invalid_grant
error_description = "Token has been expired or revoked."

UserAbortException

UserAbortException is used by the sync module to denote abort events. Abort can be initiated either by the user or by the operating system (when terminating Resco Mobile CRM because the user switched to another app).

The latter case will generate also crash log entry such as

Application 11.2.3.0 ERROR 2018-11-03 09:31:44.061+01:00
System.Exception: OnAbortBackgroundTask

Exception chaining

Let's have a look at this exception log:

Exception: Can't connect --->
Net.WebRequestException: Unable to resolve host "besin.crm5.dynamics.com": No address associated with hostname | Duration: 4ms ---> 
Java.IO.IOException: Unable to resolve host "besin.crm5.dynamics.com": No address associated with hostname ---> 
Java.Lang.RuntimeException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)

As far as the error itself is concerned, it must be a very basic connection problem, such as a missing or misconfigured internet connection.

However, this excerpt was selected for another reason - to illustrate the chaining of exceptions. In this case, it makes sense to read the chain from bottom to top.

  • On the lowest level, the operating system generated a RuntimeException with a rather technical message.
  • The middle OS layer intercepted this exception, wrapped it into IOException(RuntimeException) with a better message.
  • Resco communication module intercepted this exception and wrapped it into WebRequestException(IOException(RuntimeException)).
  • Finally, the top layer of the app (maybe SyncEngine) intercepted WebRequestException and produced the log together with the details coming from wrapped exceptions.

Error codes

Server error responses often contain error codes, such as:

Detail.OrganizationServiceFault.ErrorCode=-2147187962.

It would often help when we could translate them into a meaningful statement.

  • In the case of Dynamics CRM we could use e.g. this reference.
  • Search for Salesforce error codes at developer.salesforce.com
  • Resco Cloud error codes are listed here.

Then we could replace the above error code with this sentence:

"Not enough privilege to access the Microsoft Dynamics 365 object or perform the requested operation."

What else can be done?

Exception logs tend to be cluttered with tons of unneeded information. Resco Mobile CRM tries to simplify the exception description before writing it to the log file, yet the result may still remain unclear.

What you should do first is try to extract a piece of information that tells something relevant. Yes, it requires experience, knowledge, and intuition. But you should try it anyway.

In the next sections, we show examples of real-life exceptions together with tips on how to read them. If there is any universal advice we could give you it is this one: Simplify the exception log by stripping off unneeded details.

And do not forget - a lot of keywords used in the logs are explained somewhere on the web. So launch your favorite browser and search for that information.

Examples

Library used incorrectly

Say we have this exception log (taken from the sync log):

<Exception>08:55:13.216: SqliteException: Library used incorrectly
library routine called out of sequence
Failed cmd: DELETE FROM AttachmentQueue WHERE ID=?
  at SQLite3.Prepare (SqliteConnection cnn, String strSql, UInt32 timeoutMS, String& strRemain) <0x101b069b0 + 0x001dc> in <badc6885562c498f940d11e69afe7419#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at Resco.Data.SQLite.SQLiteDatabase.ExecuteSingleNonQuery (String query, Collections.Generic.IEnumerable`1[T] parameters) <0x101b035c0 + 0x0009b> in <badc6885562c498f940d11e69afe7419#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at Resco.Data.SQLite.SQLiteDatabase.ExecuteSingleNonQuery (String query, Object[] parameters) <0x101b03940 + 0x0002f> in <badc6885562c498f940d11e69afe7419#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at AttachmentManager.MarkAttachmentDownloaded (SyncEngine SE, Resco.Data.db, Attachment a) <0x100ecb470 + 0x0016f> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at AttachmentManager+<>c__DisplayClass18_0.<SyncAttachments>b__1 (Attachment a) <0x100ecbe30 + 0x00027> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at MultiAttachmentDownloader.Execute (Boolean asyncDownload, AttachmentDownloader downloader, Collections.Generic.List`1[T] attachments, Action`1[T] MarkDownloaded, Action CheckAbort) <0x100ecc1f0 + 0x004d3> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at AttachmentManager.SyncAttachments (ICrmService service, SyncEngine SE, Resco.Data.db) <0x100ecacd0 + 0x0053b> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at AttachmentManager.DownloadQueueSync (ICrmService service, SyncEngine SE, Resco.Data.db, MobileCrm.config, Int32 n_skipped, Action`1[T] Log) <0x100ec8640 + 0x00077> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at SyncEngine.DoExecute (Resco.Data.db) <0x100e8f650 + 0x02157> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at SyncEngine.Execute (Resco.Data.db, Boolean isHighEndDevice, SyncResult& result) <0x100e92ef0 + 0x01c07> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0 
  at SyncEngine.Execute (Resco.Data.db, MobileCrm.config, SyncResult& result, Func`3[T1,T2,TResult] progress, SyncConflict conflictCallback, Boolean isHighEndDevice, Boolean isRequestedByUser, Boolean isRestartSync, SyncBook syncBook) <0x100e95cf0 + 0x0021f> in <751aa8fdcaf64e108abd379aac6ebdb6#9b6c8013b1e83bbd2d6574e7d4e39f6b>:0
</Exception>

The above log can be simplified to this (we removed a lot of clumsy details, which not even programmers need):

<Exception>08:55:13.216: SqliteException: Library used incorrectly
library routine called out of sequence
Failed cmd: DELETE FROM AttachmentQueue WHERE ID=?
  at SQLite3.Prepare ()
  at Resco.Data.SQLite.SQLiteDatabase.ExecuteSingleNonQuery ()
  at AttachmentManager.MarkAttachmentDownloaded ()
  at MultiAttachmentDownloader.Execute ()
  at AttachmentManager.SyncAttachments ()
  at SyncEngine.Execute ()
</Exception>

As the next step, we can try to extract some meaning, e.g.:

  • This is some kind of database problem (SQLite is the database engine used by Resco mobile apps) described as "Library used incorrectly" or "library routine called out of sequence".
  • The problem arose for this SQL command: "DELETE FROM AttachmentQueue WHERE ID=?"
  • This happened during synchronization, specifically during attachment download.

In this case, we could not explain the problem, but at least we were able to describe it.

Insufficient privileges

Here is another example (taken from the online log):

OnlineError 2020-09-14T23:37:36.6485490+05:30
Called from: DynamicEntityForm`1.SaveAsyncCompleted(MobileCrm.Controllers.Common.AccountForm)
Net.RescoSoapException: Server Error: {"CallerPrincipal":{"PrincipalId":"4f0d247e-019c-e811-a96c-000d3aa30ac8","Type":8,"IsUserPrincipal":true},"OwnerPrincipal":{"PrincipalId":"00000000-0000-0000-0000-000000000000","Type":8,"IsUserPrincipal":true},"ObjectId":"fdf21d78-019c-e811-a96c-000d3aa30ac8","ObjectTypeCode":8,"EntityName":"systemuser","ObjectBusinessUnitId":"64160e70-ca11-ea11-a811-000d3a085b2b","RightsToCheck":"AppendToAccess","RoleAccessRights":"None","PoaAccessRights":"None","HsmAccessRights":"None","GrantedAccessRights":"None","Messages":["PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False","EntityUserGroupRights = None","MinimumPrivilegeDepthRequired = Global","SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0"],"EntityOwnershipTypeMask":4,"CallerInfo":{"IsSystemUser":false,"IsSupportUser":false,"IsAdministrator":false,"IsCustomizer":false,"IsDisabled":false,"IsIntegrationUser":false,"Teams":null,"Roles":null},"ReadOnlyState":"UserAndOrgFullAccess","IsHsmEnabled":false,"HsmInfo":null}
<soap>Code.Value=s:Sender| Detail.OrganizationServiceFault.ActivityId=605735e2-db46-4b69-89fa-fb1184e8fce2| Detail.OrganizationServiceFault.ErrorCode=-2147187962| Detail.OrganizationServiceFault.HelpLink=http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80048306&client=platform| Detail.OrganizationServiceFault.Timestamp=2020-09-14T18:07:36.4953731Z| Detail.OrganizationServiceFault.ExceptionRetriable=false</soap>
  at WebServiceBase.ThrowSoapException (Net.HttpException ex) [0x00043] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at WebServiceBase+XmlResponse..ctor (Object context, Boolean soap, WebServiceBase webService, Xml.XmlReaderSettings xmlSettings, Boolean processMultipartResponses) [0x00068] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at WebServiceBase.InternalEndInvoke (Object request, Func`2[T,TResult] readResponse) [0x00007] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at WebServiceBase.Invoke (String action, Object args, Action`2[T1,T2] writeRequest, Action`1[T] writeHeader, Func`2[T,TResult] readResponse) [0x0000c] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at WebServiceBase.Invoke (String action, Object args, Action`2[T1,T2] writeRequest, Func`2[T,TResult] readResponse) [0x0000a] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at Crm2011.CrmService2011.InternalExecuteRequest (Crm2011.InternalRequest request) [0x0002d] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at Crm2011.CrmService2011.ExecuteRequest (Object request) [0x00007] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at MobileCrm.Data.Online.SaveRequest.SendEntityInternal (ICrmService service, MobileCrm.Data.DynamicEntity record) [0x0000c] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at MobileCrm.Data.Online.SaveRequest.SendEntity (ICrmService service, MobileCrm.Data.DynamicEntity entity, Boolean recursive) [0x00045] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at MobileCrm.Data.Online.SaveRequest.Execute (ICrmService service) [0x00013] in <50637abbe03e41ca9d84f19a186fc0d1>:0 
  at MobileCrm.Data.Online.OnlineRepository.RequestThread () [0x000eb] in <50637abbe03e41ca9d84f19a186fc0d1>:0

After the simplification:

OnlineError 2020-09-14T23:37:36.6485490+05:30
Called from: DynamicEntityForm.SaveAsyncCompleted(AccountForm)
RescoSoapException: Server Error: {"CallerPrincipal":{"PrincipalId":"4f0d247e-019c-e811-a96c-000d3aa30ac8","Type":8,"IsUserPrincipal":true},"OwnerPrincipal":{"PrincipalId":"00000000-0000-0000-0000-000000000000","Type":8,"IsUserPrincipal":true},"ObjectId":"fdf21d78-019c-e811-a96c-000d3aa30ac8","ObjectTypeCode":8,"EntityName":"systemuser","ObjectBusinessUnitId":"64160e70-ca11-ea11-a811-000d3a085b2b","RightsToCheck":"AppendToAccess","RoleAccessRights":"None","PoaAccessRights":"None","HsmAccessRights":"None","GrantedAccessRights":"None","Messages":["PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False","EntityUserGroupRights = None","MinimumPrivilegeDepthRequired = Global","SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0"],"EntityOwnershipTypeMask":4,"CallerInfo":{"IsSystemUser":false,"IsSupportUser":false,"IsAdministrator":false,"IsCustomizer":false,"IsDisabled":false,"IsIntegrationUser":false,"Teams":null,"Roles":null},"ReadOnlyState":"UserAndOrgFullAccess","IsHsmEnabled":false,"HsmInfo":null}
<soap>Code.Value=s:Sender| Detail.OrganizationServiceFault.ActivityId=605735e2-db46-4b69-89fa-fb1184e8fce2| Detail.OrganizationServiceFault.ErrorCode=-2147187962| Detail.OrganizationServiceFault.HelpLink=http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80048306&client=platform| Detail.OrganizationServiceFault.Timestamp=2020-09-14T18:07:36.4953731Z| Detail.OrganizationServiceFault.ExceptionRetriable=false</soap>
  at WebServiceBase+XmlResponse..ctor ()
  at WebServiceBase.Invoke ()
  at Crm2011.CrmService2011.ExecuteRequest ()
  at MobileCrm.Data.Online.SaveRequest.SendEntity ()
  at MobileCrm.Data.Online.SaveRequest.Execute ()
  at MobileCrm.Data.Online.OnlineRepository.RequestThread ()

The first conclusion is that the problem happened when saving (because of "SaveRequest") an account (because of "AccountForm") to the (Dynamics) server. We also see that server responded with some error message. Let's try to extract some useful info out of it.

The main error message is here:

{"CallerPrincipal":{"PrincipalId":"4f0d247e-019c-e811-a96c-000d3aa30ac8","Type":8,"IsUserPrincipal":true},"OwnerPrincipal":{"PrincipalId":"00000000-0000-0000-0000-000000000000","Type":8,"IsUserPrincipal":true},"ObjectId":"fdf21d78-019c-e811-a96c-000d3aa30ac8","ObjectTypeCode":8,"EntityName":"systemuser","ObjectBusinessUnitId":"64160e70-ca11-ea11-a811-000d3a085b2b","RightsToCheck":"AppendToAccess","RoleAccessRights":"None","PoaAccessRights":"None","HsmAccessRights":"None","GrantedAccessRights":"None","Messages":["PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False","EntityUserGroupRights = None","MinimumPrivilegeDepthRequired = Global","SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0"],"EntityOwnershipTypeMask":4,"CallerInfo":{"IsSystemUser":false,"IsSupportUser":false,"IsAdministrator":false,"IsCustomizer":false,"IsDisabled":false,"IsIntegrationUser":false,"Teams":null,"Roles":null},"ReadOnlyState":"UserAndOrgFullAccess","IsHsmEnabled":false,"HsmInfo":null}

Note that the message uses JSON formatting, which uses to be explained as a property bag. It means a set of properties with their values; values can be strings, numbers, or more complex objects:

  • Array (enclosed in [])
  • Another property bag (enclosed in {})

Let's format our error to make it more readable:

CallerPrincipal : {PrincipalId:"4f0d247e-019c-e811-a96c-000d3aa30ac8", Type:8, IsUserPrincipal:true},
OwnerPrincipal : {PrincipalId:"00000000-0000-0000-0000-000000000000", Type:8, IsUserPrincipal:true},
ObjectId : "fdf21d78-019c-e811-a96c-000d3aa30ac8",
ObjectTypeCode : 8,
EntityName : systemuser,
ObjectBusinessUnitId : "64160e70-ca11-ea11-a811-000d3a085b2b",
RightsToCheck : AppendToAccess,
RoleAccessRights : None,
PoaAccessRights : None,
HsmAccessRights : None,
GrantedAccessRights : None,
Messages:[
  PrincipalHasOwnerPrincipalWithAtLeastBasicPrivilegeDepth = False,
  EntityUserGroupRights = None,
  MinimumPrivilegeDepthRequired = Global,
  SecLib::AccessCheckEx2 failed. Owner Data: User principal 00000000-0000-0000-0000-000000000000 is not loaded in UserDataCache yet; Principal Data: roleCount=2, privilegeCount=821, accessMode=0
],
EntityOwnershipTypeMask : 4,
CallerInfo : {IsSystemUser:false, IsSupportUser:false, IsAdministrator:false, IsCustomizer:false, IsDisabled:false, IsIntegrationUser:false, Teams:null, Roles:null},
ReadOnlyState : UserAndOrgFullAccess,
IsHsmEnabled : false,
HsmInfo : null

The above text should be interpreted by a Dynamics expert, but we can draw some conclusions, too.

  • The term principal refers to users or teams, i.e. to subjects that can be assigned security roles (and thus access permissions).
  • The concerned entity is systemuser (8 is its typecode). We see also the ID of systemuser record, but we can't use this information right now.
  • As next we see several statements related to access rights. Here is some background info: Role refers to user access rights, POA refers to sharing, HSM probably to hierarchical security, etc. AppendToAccess refers to the access right defined as "The right to append another record to the specified object." In all cases we see "None" which seems to indicate insufficient privileges.

Additional details of the server response are listed between the tags <soap>...</soap>. Most of them seem to be useless, but we could at least try to decipher ErrorCode=-2147187962.

I used Google and out of many results selected this advice: "Can you check what permissions you have for the AppendTo privilege for your custom entity. Also, check that the systemuser entity has append and appendto privileges for the role that you are testing with."

Conclusion: Looks like our mobile user has insufficient privileges to execute the attempted operation. Ask the server admin for help.

Example 2