Issue Deleting or Editing Activities in the Infor CRM web client

We recently had a client run into a strange issue we had never come across before.

Certain activities could not be edited or deleted.

When deleting you would get an event log error of:

“slxErrorId”: “SLXD36E809C819A4228”,
“mitigation”: “AjaxMessagingServiceError (500)”,
“date”: “2018-09-04T20:01:53”,
“utc”: “2018-09-04T20:01:53”,
“message”: “deleted object would be re-saved by cascade (remove deleted object from associations)[Sage.SalesLogix.Activity.UserActivity#Sage.SalesLogix.Activity.UserActivity].”,
“source”: “NHibernate.Impl.SessionImpl, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4”,
“type”: “NHibernate.ObjectDeletedException”,
“stackTrace”: ” at NHibernate.Impl.SessionImpl.ForceFlush(EntityEntry entityEntry)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.EntityIsTransient(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.PerformSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Event.Default.DefaultSaveOrUpdateEventListener.OnSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.FireSaveOrUpdate(SaveOrUpdateEvent event)\r\n at NHibernate.Impl.SessionImpl.SaveOrUpdate(String entityName, Object obj)\r\n at NHibernate.Engine.CascadingAction.SaveUpdateCascadingAction.Cascade(IEventSource session, Object child, String entityName, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeToOne(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeAssociation(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeProperty(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeCollectionElements(Object parent, Object child, CollectionType collectionType, CascadeStyle style, IType elemType, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeCollection(Object parent, Object child, CascadeStyle style, Object anything, CollectionType type)\r\n at NHibernate.Engine.Cascade.CascadeAssociation(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeProperty(Object parent, Object child, IType type, CascadeStyle style, Object anything, Boolean isCascadeDeleteEnabled)\r\n at NHibernate.Engine.Cascade.CascadeOn(IEntityPersister persister, Object parent, Object anything)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.CascadeOnFlush(IEventSource session, IEntityPersister persister, Object key, Object anything)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.PrepareEntityFlushes(IEventSource session)\r\n at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event)\r\n at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)\r\n at NHibernate.Impl.SessionImpl.Flush()\r\n at NHibernate.Transaction.AdoTransaction.Commit()\r\n at Sage.Platform.Framework.Scopes.TransactionScope.PerformDisposal(ICollection`1 sessions)\r\n at Sage.Platform.Framework.Scopes.AbstractScope.Dispose()\r\n at Sage.SalesLogix.Activity.Entities.Activity.Delete() in c:\\Users\\Administrator\\AppData\\Roaming\\Sage\\Platform\\Output\\implementation\\Activity.cs:line 1688\r\n at Sage.SalesLogix.Activity.Activity.Delete()\r\n at Sage.SalesLogix.Activity.Entities.Activity.Sage.Platform.Orm.Interfaces.IPersistentEntity.Delete() in c:\\Users\\Administrator\\AppData\\Roaming\\Sage\\Platform\\Output\\implementation\\Activity.cs:line 1812\r\n at Sage.Platform.NHibernateRepository.NHibernateRepository.DeleteImpl(Object instance)\r\n at Sage.Platform.NHibernateRepository.NHibernateRepository.Sage.Platform.Repository.IRepository.Delete(Object instance)\r\n at Sage.Platform.EntityFactory.Delete(Object instance)\r\n at Sage.SalesLogix.SystemAdapter.Activities.ActivityRequestHandler.DeleteEntity(IActivity entity)\r\n at Sage.Platform.SData.RequestHandlerBase`3.InternalDelete(TEntity entity, String ifMatch)\r\n at Sage.Platform.SData.RequestHandlerBase`3.Delete()\r\n at Invokef9b46739094e4b718ef61a2facd37f9f.Invoke(Object , IRequest )\r\n at Sage.Integration.Messaging.RequestTargetRegistration.RequestTargetInvoker.Invoke(IRequest request)\r\n at Sage.Integration.Messaging.Request.Process(RequestTargetInvoker invoker)\r\n at Sage.Integration.Adapter.AdapterController.RealAdapterController.Process(IRequest request)\r\n at Sage.Integration.Adapter.AdapterController.RealAdapterController.ProcessWorker(IProtocolRequest protocolRequest)\r\n at Sage.Integration.Adapter.AdapterController.Process(IProtocolRequest request)\r\n at Sage.Integration.Messaging.MessagingService.Process(IProtocolRequest protocolRequest)”

When editing you would get a different even log error of:

“slxErrorId”: “SLXE36B785D4E1E241C”,
“mitigation”: “AjaxMessagingServiceError (500)”,
“date”: “2018-09-05T16:11:23”,
“utc”: “2018-09-05T16:11:23”,
“message”: “Requested value ‘Delete’ was not found.”,
“source”: “System.Enum+EnumResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”,
“type”: “System.ArgumentException”,
“stackTrace”: ” at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)\r\n at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)\r\n at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)\r\n at NHibernate.Type.EnumStringType.GetInstance(Object code)”,
“targetSite”: “Void SetFailure(ParseFailureKind, System.String, System.Object)”,
“fullException”: “Sage.Common.Syndication.DiagnosesException: Can’t Parse Delete as UserNotificationType —> —> NHibernate.HibernateException: Can’t Parse Delete as UserNotificationType —> System.ArgumentException: Requested value ‘Delete’ was not found.\r\n at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument)\r\n at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult)\r\n at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)\r\n at NHibernate.Type.EnumStringType.GetInstance(Object code)\r\n — End of inner exception stack trace —\r\n at NHibernate.Type.EnumStringType.GetInstance(Object code)\r\n at NHibernate.Type.EnumStringType.Get(IDataReader

The issue is that in the entity events of the activity area for both updating and deleting, there is code to check the USERNOTIFICATION table and perform business logic. When these activities have that code checked, they contained an unexpected value in the USERNOTIFICATION.TYPE field. This field is an enumerated property in the entity model. This means that it translates the text value into a defined numeric value based on the enumeration definition.

There were a handful of activities that had a non-matching TYPE value. We were not clear how they were added but they had been created years ago.

I ran a query to find non-matching values:

select  distinct type from sysdba.USERNOTIFICATION where type not in ('New','Change','Deleted','Confirm','Decline','Unknown','Leader','Completed','Removed')

In this case it was only a single non-matching value used for some USERNOTIFICATION records. A result of “Delete”.

For those non-matching values I created a update SQL statement to change those to a valid Type enumeration value, like this:

update sysdba.usernotification set type='Deleted' where type='Delete'

After running that, the activities could then be edited/deleted normally.

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!