Validating missing "Object Not Set to a Reference" on Form Rule Sets in K2 Designer
kbt145421
PRODUCTIssue
When editing Form rules the following error appears: "Object Reference not set to an instance of an object"
Symptoms
You are unable to edit any form rules on form level due to invalid event definitions.
Error:
"Object Reference not set to an instance of an object"Troubleshooting Steps
To determine if there are missing orphaned references, execute the script below:
--######################################################################
--### Instructions ###
-- 1. Check out only the forms that have the Object Reference error which you want to fix.
-- 2. Run the SQL script against the K2 database.
--######################################################################
Use [K2Database]
GO
declare @OrpanedReference int
select @OrpanedReference = count(*) from (
select ID
from [Form].[HandlerInstance_Design]
where
Functions.value('(/Function/@InstanceID)[1]', 'nvarchar(50)') is not null and
Functions.value('(/Function/@InstanceID)[1]', 'nvarchar(50)') not in (SELECT [ID] FROM [Form].[AreaItem_Design])
) as a
if(@OrpanedReference>0)
begin
print 'There are ' + cast(@OrpanedReference as nvarchar(10)) + ' orphaned references found.'
end
else
print 'There were no orphaned references found.'
Under normal circumstances, no data should be displayed on any of the results.
Should the results display data, it means that orphaned references were found, which is the cause of the error.
To resolve this issue, direct database modification will be required. Please log a K2 Support Ticket on the K2 Customer Portal for assistance in resolving the issue.