You are currently viewing Error- Object reference not set to an instance of an object.” error while opening the form.

Error- Object reference not set to an instance of an object.” error while opening the form.

Description:
Hello there, I am encountering an error message stating “Object reference not set to an instance of an object.” when attempting to open the form. According to the server logs, this issue occurs because a deleted data connection is still attempting to load during form opening, indicating a potential bug. Interestingly, after re-adding the same data connection, the issue disappears, even though the data connection is unnecessary. I would like to know how to prevent this issue without having to add the redundant data connection. I have attached the server log files and a screenshot of the error for your reference.

Works with 20x;12x

Solution:

The error being encountered is a generic one, and there can be multiple reasons for its occurrence. To investigate further, it is advised to obtain the Evolve/Composer logs from the user and examine if the error is related to a redundant or modified data connection.

If the user is experiencing this issue with a migrated solution, it could be due to a control that was initially a dropdown in the Foundation version but has now been changed to a textbox. The dropdown control might have had a range property with a reference to a data connection.

The root cause of the problem is that changing the type of the dropdown to a textbox does not automatically remove the range property from the dropdown schema. In Evolve, there is a code snippet that assumes any control with a range property is a dropdown and attempts to fetch data from the associated data connection.

To address this issue, the following workaround can be performed:

  1. Change the textbox control back to a dropdown, adjust the range to a static value, and then change the control type back to a textbox.
  2. Redeploy the solution and verify if the issue is resolved.

Alternatively, another approach to resolve the issue is to completely delete the control (including from the FormData) and then re-add the textbox.

Please note that these workarounds are provided based on the given context, and it is recommended to analyze the logs and thoroughly test the solution after implementing any changes.

Leave a Reply