Question

Photo of Bob Chelpka

0

Error Object reference not set to an instance of an object.

We recently updated to version 13.8. (I know we're way behind...) Anyway, we started to receive the error in the image below on an event registration that has been in use for a number of years and has multiple instances. We went to attempt to edit the form on the registration and this error popped up. It will not allow us to edit the registration, but we can view what is on the form. We have been able to create a new instance for the event but we are not sure whether or not it will work properly. Does anyone have any idea what the problem might be or how it can be fixed outside of recreating the registration from scratch? Thanks

Rock_Error.JPG



  • Photo of David Axelson

    0

    Hi Bob!

    I ran into this issue the other day with someone on Rocket.Chat. We ended up running some SQL in the SQL Command (Admin Tools > Power Tools > SQL Command) to troubleshoot. Here's a similar setup:

    ------------------------------------------------------------------------
    --  Update DECLARE to RegistrationTemplate Id
    --  Returns Error! under Configuration if attribute is missing
    --  If Error! is found, use SQL to delete the
    --  row using RegistrationTemplateFormField Id (Id Column)
    ------------------------------------------------------------------------
    
    DECLARE @registrationtemplateid INT = 620
    
    SELECT
        rtff.[Id]
        , CASE WHEN rtff.[FieldSource] = 0 THEN CONCAT('Person Field ',rtff.[PersonFieldType]) ELSE a.[Name] END AS [Field]
        , CASE WHEN rtff.[FieldSource] <> 0 AND rtff.[PersonFieldType] = 0 AND rtff.[AttributeId] IS NULL THEN 'Error!' ELSE 'Correct' END AS [Configuration]
        , aq.[Value] AS [Values]
    FROM
        [RegistrationTemplate] rt
        INNER JOIN [RegistrationTemplateForm] rtf ON rtf.[RegistrationTemplateId] = rt.[Id]
        INNER JOIN [RegistrationTemplateFormField] rtff ON rtff.[RegistrationTemplateFormId] = rtf.[Id]
        LEFT JOIN [Attribute] a ON a.[Id] = rtff.[AttributeId]
        LEFT JOIN [AttributeQualifier] aq ON aq.[AttributeId] = a.[Id] AND aq.[Key] = 'values'
    WHERE
        rt.[Id] = @registrationtemplateid
    

    There should always be an Attribute connected to a RegistrationTemplateFormField entity and in their case, that Attribute did not exist. If that's the same issue for you, it'll show "Error!" in the configuration column. We used another SQL command to delete that RegistrationTemplateFormField, which let them back into the edit page for the template. That would work something like this:


    ------------------------------------------------------------------------
    --  Update DECLARE to RegistrationTemplateFormField Id
    --  Deletes the RegistrationTemplateFormField
    --  Once that's done, you should be able to edit the 
    --  RegistrationTemplate through the Event Registrations page
    ------------------------------------------------------------------------
    
    DECLARE @registrationtemplateformfieldid INT = 1234
    
    DELETE
        [RegistrationTemplateFormField]
    WHERE
        [Id] = @registrationtemplateformfieldid
    

    Be Aware: SQL is, as Jon calls it, "outside the castle walls". It is very powerful and will let you delete things that you may not want to delete. It's the best solution to this problem, but it needs to be done carefully so as not to accidentally delete something else.

    Feel free to reach out on Rocket.Chat (@david.axelson), if I can help any further.