3

Resolved

Max Length Rule Action 'Send an Email' Body field

description

When porting a rule from v1.5.x to 1.6.x the 'Save' of the action 'Send an Email' failed with no UI messages.
The log included the exception as listed below.

Seems an important issue as even a small sized HTML email easily exceeds the limit. Minifying the HTML could be a workaround in some cases.

2012-11-12 12:53:52,092 [17] NHibernate.Transaction.ITransactionFactory - DTC transaction prepre phase failed
NHibernate.PropertyValueException: Error dehydrating property value for Orchard.Rules.Models.ActionRecord.Parameters ---> NHibernate.HibernateException: The length of the string value exceeds the length configured in the mapping/parameter.
at NHibernate.Type.AbstractStringType.Set(IDbCommand cmd, Object value, Int32 index)
at NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index)
at NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, Boolean[] settable, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
--- End of inner exception stack trace ---
at NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session)
at NHibernate.Action.EntityUpdateAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.DistributedTransactionContext.System.Transactions.IEnlistmentNotification.Prepare(PreparingEnlistment preparingEnlistment)

comments

j3ffb wrote Jan 14, 2013 at 3:16 PM

I came across this as well, the fix is for a [StringLengthMax] attribute to be added to the Parameters property in Orchard.Rules.Models.ActionRecord

justrhysism wrote Feb 14, 2013 at 11:26 PM

I'm having the exact same issue, however the Attribute on the ActionRecord model hasn't fixed it. Is there something else I need to do? Am I missing something?

justrhysism wrote Feb 14, 2013 at 11:58 PM

Actually scratch that - I needed to clean and rebuild, my bad, I thought I had before I commented. The solution works! Thanks a bunch @j3ffb!