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

Question

Question

Error downloading form

asked on April 29, 2016

Yesterday, when I tried downloading a form from our Test Forms site (in hopes of uploading it to our Production Forms site), I experienced a 500 error, and when I checked the Event Logs on that machine, I found the following:

Message: Attaching an entity of type 'Laserfiche.Forms.EntityModels.cf_rules' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.

We get a similar error when trying to copy a form, however I was able to get around that once, but never again.  We have tried Internet Explorer and Chrome, and I have also tested this on a completely separate machine referencing the same database, and upgraded to Forms 10.1.  

Thanks in advance to anyone who can assist with this issue!

Marty Gaffney - Network Technician
Town of Okotoks

0 0

Replies

replied on April 29, 2016

Hi Marty,

It seems something went wrong in your database.

Could you try to load your form in Form Designer page (Form>Layout) so temp data can be cleared in your database, then try to export it again?

 

If this doesn't help, please open a support case and our support team would happy to help you out.

 

Thank you!

 

 

2 0
replied on July 18, 2017

Would you guys mind elaborating a little more on this topic and how you were able to clear up the error?  I am having the same issue and am kinda at a loss.

1 0
replied on April 29, 2016

Hi:

Thanks for the reply!

I tried going to the Designer page of each of the three forms within this one form, and I also cleared out all suspended tasks and cleared out all errors in the Process Diagram, but this didn't work to fix the issue (although the trick for clearing out temp data from our database will come in handy down the road!).

I'll open up a support case when I get the chance here - appreciate the help!

Marty

0 0
replied on May 2, 2016

We were able to resolve this issue.  The problem had to do with some stray code on one of the forms, which resolved itself after this, and the problematic form, were deleted and recreated.

Thanks for your suggestion about clearing temp data, I'll be remembering that one down the road. :)

Marty Gaffney - Network Technician

Town of Okotoks

0 0
replied on May 2, 2016

Hi Marty,

Thanks for the feedback!

1 0
replied on October 23, 2019 Show version history

Just chiming in as I experienced this issue this morning and was able to pin point the issue.

  • This issue happened after I duplicated an existing form within a process.
  • In our case, the duplicated form included fields that had field rules on them (I think this may be part of the issue).
  • The master form (which we had duplicated from) was referenced and connected within the business process already. Our duplicate was not yet connected to anything.
  • I did not require all of the same fields from the master form, so, I had deleted some of the fields in the duplicate.
  • These fields had field rules on them. I was prompted / asked if I wanted to continue deleting these fields as they were bound to field rules and deleting them would delete the field rules. I accepted.
  • The fields "appeared" to be deleted but if you refreshed the form, it would continue to display the fields that were supposed to be deleted.
  • Checking the field rules page shows no field rules (part of the field deletion prompted earlier seems to have held). Attempting to delete the fields continues to prompt for confirmation on deleting field rules that don't exist.
  • At this point, navigating to the process will show an infinite loop and will never load. The process is now permanently broken. 
  • Deleting the duplicate form - does not fix the issue.
  • Duplicating the process - does not work (internal error).
  • The solution in our case (which was a lossy one), was to restore the Forms SQL database to the point in time before the fields with rules were deleted. At this point in time you can delete the form and your process won't be corrupted.
  • You can obviously go further back to before you duplicated the form.. but we spent time troubleshooting the cause to avoid it from happening again in the future.

 

Hope this information helps someone.

 

Details:
URL: /Forms/webapi/v1/businessprocess?sourceId=27
Error: UnexpectedError
Date: 24/10/2019 8:07:00 a.m. (New Zealand Standard Time)
HTTP Status Code: 500
Business Process ID: 0
User: *REDACTED*
IP: *REDACTED*
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.50 Safari/537.36
Business Process Name: 

Stack Trace:
Caught exception: Laserfiche.Forms.CommonUtils.Exceptions.LFFormsException
Message: An unexpected error has occurred. [LFF502-UnexpectedError]

Inner exception: System.InvalidOperationException
Message: Attaching an entity of type 'Laserfiche.Forms.EntityModels.cf_rules' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.
   at System.Data.Entity.Core.Objects.ObjectContext.VerifyRootForAdd(Boolean doAttach, String entitySetName, IEntityWrapper wrappedEntity, EntityEntry existingEntry, EntitySet& entitySet, Boolean& isNoOperation)
   at System.Data.Entity.Core.Objects.ObjectContext.AttachTo(String entitySetName, Object entity)
   at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Attach(Object entity)
   at System.Data.Entity.DbSet`1.Attach(TEntity entity)
   at Laserfiche.Forms.EntityModels.cf_fields.DeleteFieldAndRules(IEntityContext appContext, cf_fields field)
   at E_Forms.Models.ViewModels.Design.FieldModel.WriteFieldsToDb(cf_forms currentForm, cf_bp_processes topLevelProcess, cf_users currentUser)
   at E_Forms.WebApi.Version1.Controllers.BusinessProcessController.Post(BusinessProcessDC bpToCreate, Nullable`1 sourceId, String template)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()

 

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

Sign in to reply to this post.