Recently one of our clients ran into an issue with the Dynamics 365 Portals create record functionality. After completing and submitting an insert entity form, a generic error was returned, and the record was not created. This blog shows an example of the issue and how to resolve it.
The screenshots above and below show a quick Entity form and Portal Page I created in a trial portal instance against the contact entity.
The screenshot below shows the error which is displayed when I attempt to create this record from the portal.
With the Dynamics 365 portal you can set up error logging, which can be stored in Azure Blob Storage. The text below is a snippet of the error message that I retrieved from Azure after the above error occurred.
SourceFilePath:G:\Agents\BA4504\_wap\12\s\Framework\Adxstudio.Xrm\Threading\FluentSchedulerJob.cs, SourceLineNumber:75, ExceptionMessage:Object reference not set to an instance of an object.
at Adxstudio.Xrm.EventHubBasedInvalidation.EventHubJob.ExecuteInternal(Guid id) in G:\Agents\BA4504\_wap\12\s\Framework\Adxstudio.Xrm\EventHubBasedInvalidation\EventHubJob.cs:line 77
at Adxstudio.Xrm.Threading.FluentSchedulerJob.Execute() in G:\Agents\BA4504\_wap\12\s\Framework\Adxstudio.Xrm\Threading\FluentSchedulerJob.cs:line 50
The issue seems to occur when the Status Reason field is required and on the form. Because the Status Reason is a locked field in the Dynamics 365 portal it can’t be populated and hence throws a NullReferenceException error when the form attempts to save with it empty. The screenshot below submits successfully as I have made the Status Reason not required.