You are viewing limited content. For full access, please sign in.

Question

Question

Forms Instance stuck on End Event

asked on April 19, 2022

I have a Forms instance that is stuck on an End Event. In Forms Monitor it shows that the instance is still in progress, and pulling the instance data from the Forms database shows that it is currently in progress at an End Event step. How do I get the end event to complete without cancelling the instance?

Forms version: 10.4.4.444

0 0

Answer

SELECTED ANSWER
replied on April 22, 2022
--The ID of the instance
declare @bpInstanceId int=1490871
-- The ID of the current step
declare @currentStepId int=15
declare @instanceId int
declare @processId int
declare @stepStartDate nvarchar(50)
declare @stepFinishDate nvarchar(50) = GETUTCDATE()

select @instanceId=instance_id, @processId=current_process_id,@stepStartDate=update_date from [dbo].cf_bp_worker_instances where bp_instance_id=@bpInstanceId and current_step_id=@currentStepId
-- set worker instance status to complete
update cf_bp_worker_instances set status=8 where instance_id=@instanceId
-- set worker instance history status to complete
if not exists (select * from [dbo].[cf_bp_worker_instance_history] where instance_id = @instanceId and step_id=@currentStepId )
	  -- insert worker instance history if no history exist
	    insert into [dbo].cf_bp_worker_instance_history(instance_id,process_id ,step_id,start_date,finish_date,status ,submission_id ,external_op,external_op_data1 ,archived_worker_instnc_to_resume,current_priority)values(@instanceId,@processId,@currentStepId,@stepStartDate,@stepFinishDate,'complete',NULL,NULL,NULL,NULL,0)
else
	    update[dbo].cf_bp_worker_instance_history set status='complete' where instance_id = @instanceId and step_id =@currentStepId
-- set the main instance status to complete
update [dbo].[cf_bp_main_instances] set status=2 where bp_instance_id=@bpInstanceId

Please backup your database before run the above queries.

0 0

Replies

replied on April 20, 2022

There is no out of box option for it. The instance may stuck at the end event for some unexpected issues. If this is the only running step for the instance, you can run some SQL query to update the status of the end event step as well as the instance. Did you get the instance with query from https://answers.laserfiche.com/questions/197726/Forms-SQL-query-for-all-instances-at-a-gateway-step#197835 ? Can you share the query result for the instance? 

0 0
replied on April 20, 2022

Yes, the instance information came from that thread. Here is a screenshot of the results:

0 0
replied on April 21, 2022

What would be the correct query to update them?

0 0
SELECTED ANSWER
replied on April 22, 2022
--The ID of the instance
declare @bpInstanceId int=1490871
-- The ID of the current step
declare @currentStepId int=15
declare @instanceId int
declare @processId int
declare @stepStartDate nvarchar(50)
declare @stepFinishDate nvarchar(50) = GETUTCDATE()

select @instanceId=instance_id, @processId=current_process_id,@stepStartDate=update_date from [dbo].cf_bp_worker_instances where bp_instance_id=@bpInstanceId and current_step_id=@currentStepId
-- set worker instance status to complete
update cf_bp_worker_instances set status=8 where instance_id=@instanceId
-- set worker instance history status to complete
if not exists (select * from [dbo].[cf_bp_worker_instance_history] where instance_id = @instanceId and step_id=@currentStepId )
	  -- insert worker instance history if no history exist
	    insert into [dbo].cf_bp_worker_instance_history(instance_id,process_id ,step_id,start_date,finish_date,status ,submission_id ,external_op,external_op_data1 ,archived_worker_instnc_to_resume,current_priority)values(@instanceId,@processId,@currentStepId,@stepStartDate,@stepFinishDate,'complete',NULL,NULL,NULL,NULL,0)
else
	    update[dbo].cf_bp_worker_instance_history set status='complete' where instance_id = @instanceId and step_id =@currentStepId
-- set the main instance status to complete
update [dbo].[cf_bp_main_instances] set status=2 where bp_instance_id=@bpInstanceId

Please backup your database before run the above queries.

0 0
replied on April 22, 2022

If I swap out the bpInstanceId and currentStepId values, can I use the same query for the instance at the TimerCatchEvent?

0 0
replied on April 27, 2022 Show version history

Have you checked the instance with in progress timer catch event also have other in progress step such as user task? The select query I provided in the other post excludes user task, so please confirm the step the timer catch event attached to is not in progress before you want to use query to end the instance. 

0 0
replied on April 28, 2022

The task has completed.

0 0
replied on May 8, 2022

Sorry for the late response, you can use the same query to update the instance for the TimerCatchEvent with the proper bpInstanceId and currentStepId values.

0 0
replied on October 11, 2023 Show version history

Does this query work for gateway tasks? I tried the query on the following instances and they do not complete.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.