In fulfilling a requirement: when users were automatically added to a team called "service team" after they were created, a strange error was encountered. The error log of
CRM only had a simple
Generic SQL error.
// Join the designated team
sysService.Associate("systemuser", systemuserId, new Relationship("teammembership_association"), relatedEntities);
The plug-in can be executed asynchronously.
dbo.SystemUserPrincipals already has a record about this user and this team, but this user is obviously newly created and should not appear in this table in principle, so the specific reason cannot be understood through the prompt Caused an error, so I searched this as a keyword, and finally found the same situation encountered by someone in foreign communities. It is recommended that the cause of this error should be that the system did not complete the creation operation when the
POSTOPERATION event of
SystemUser was triggered. As a result, you only need to change the original plug-in to asynchronous execution.