I have a form which when attempting to delete states that there is a reference to the form in the process. I have already searched for the form using the manual look at each activity twice over, and have a second person do the same. How do I find the reference when I can not find it by a rigorous manual inspection?
Question
Question
Answer
Support looked at your process and found that in the user task "New Grant Application Notification", it's configured to email the user with the attached form. If you change those email settings, you'll be able to delete the form.
Replies
You could try a database query like this:
SELECT f.[name] AS form_name, bp2.name AS process_name, step.name AS step_name, step.definition_json AS step_definition FROM [LFForms].[dbo].[cf_forms] AS f LEFT JOIN [LFForms].[dbo].[cf_form_process_mapping] AS fm ON fm.form_id = f.form_id LEFT JOIN [LFForms].[dbo].[cf_bp_step_form_mapping] AS sfm ON sfm.[form_id] = f.[form_id] AND sfm.[process_id] = fm.process_id LEFT JOIN [LFForms].[dbo].[cf_bp_steps] AS step ON step.process_id = fm.process_id AND step.[step_id] = sfm.[step_id] LEFT JOIN [LFForms].[dbo].[cf_bp_processes] AS bp ON bp.process_id = fm.process_id LEFT JOIN [LFForms].[dbo].[cf_business_processes] AS bp2 ON bp2.bp_id = bp.bp_id WHERE f.[name] LIKE '%form%' AND bp2.name LIKE '%process%'
Hi Matthew
I was able to successfully run the query but it only returns this result. Not sure how it will lead me to the reference
Those last two columns should be referring to the user task step that is using the form - the fact that those are NULL confirms you assertion that no tasks are linked to the form. Really odd that you're getting that error about not being able to delete the form.
I'm a little stumped on this one.
In your shoes, I would try this:
Modify that last query to include f.form_id with the returned values, and then search for any reference in any table that includes the form_id value - just to see if it draws your attention to anything weird.
You can find every table that includes the form_id value using a query like this:
SELECT c.name AS 'ColumnName', t.name AS 'TableName' FROM sys.columns AS c JOIN sys.tables AS t ON c.object_id = t.object_id WHERE c.name = 'form_id'
And then just search them like this, just changing the table names:
SELECT * FROM cf_forms WHERE form_id = 0
Only returns one row, for the process Grant Application which contains the form.
Replace the table name on line 2 of the second query, with each of the table names that were returned from the first query. This is just trying to see if there are any unexpected references to that form that could explain why the process isn't letting you delete it despite it not being linked to a step.
It's what I would try next, but that's mostly out of a desire to understand what is going on.
Other ideas would be things like checking the event logs on the server, recycling the IIS App Pool on the server, and restarting the LFForms services on the server.
All these suggestions are just ideas to try - I can't promise any of them will yield anything, because I've never seen or read about this issue before.
Open up a support case if you'd like our team to help troubleshoot. Definitely looks strange.
Did you check if the form was being used as an email attachment? Or in a save to repository? Just guesses
That's a really good point!
And the query I shared before was looking for form_id linked in the form_id field, which works for user tasks, but doesn't work for service tasks like archive and email - in those, the form_id is actually inside the definition_json field and the form_id field is set to NULL.
Here's a new version of the original query I posted, modifying line #9. The modification changes the JOIN to utilize the definition_json field instead of the form_id field.
SELECT f.[name] AS form_name, bp2.name AS process_name, step.name AS step_name, step.definition_json AS step_definition FROM [LFForms].[dbo].[cf_forms] AS f LEFT JOIN [LFForms].[dbo].[cf_form_process_mapping] AS fm ON fm.form_id = f.form_id LEFT JOIN [LFForms].[dbo].[cf_bp_step_form_mapping] AS sfm ON sfm.[form_id] = f.[form_id] AND sfm.[process_id] = fm.process_id LEFT JOIN [LFForms].[dbo].[cf_bp_steps] AS step ON step.process_id = fm.process_id AND step.[definition_json] LIKE CONCAT('%"form_stl":"', f.[form_id], '%') LEFT JOIN [LFForms].[dbo].[cf_bp_processes] AS bp ON bp.process_id = fm.process_id LEFT JOIN [LFForms].[dbo].[cf_business_processes] AS bp2 ON bp2.bp_id = bp.bp_id WHERE f.[name] LIKE '%form%' AND bp2.name LIKE '%process%'
Thanks for this, it does return an exact Task Name. However that is one of the ones we checked, because we checked the entire process. I checked it again, and I tried changing the form, saving it, and changing it back and saving it.
We did not skip over the email tasks while looking at the process, we looked at every task except workflow tasks since they can not reference a form.
I am submitting the process to support to take a look. It is not causing a big problem but they would like to know why they can not delete their older versions of forms as they make updates, the form list is getting unwieldy.
Please include the task name in the support case with the process.
Support looked at your process and found that in the user task "New Grant Application Notification", it's configured to email the user with the attached form. If you change those email settings, you'll be able to delete the form.
Yes that was it! There is an option to send a copy of a different form as part of the Email notification built into a User Task, so in this way, one task can reference up to 2 different forms.
I updated it to use the Currently Assigned form instead and it resolved the reference.
The query did in fact return the correct task name, but I was looking under Form, to see which Form was assigned to the task.