Community
Showing results for 
Search instead for 
Do you mean 
Reply

Custom Enitity Field Creation Error

Highlighted
New Member
Posts: 2
Country: USA

Custom Enitity Field Creation Error

I'm creating a customer field and receive this error message while debugging.  This with ACT 2011 Professional.  The code has not change from the Previous version of ACT! The code worked find in ACT2010.

                field = new FieldDescriptor("FieldName", "AliasName", descriptor, FieldDataType.Decimal);
                field.AllowEmpty = true;
                field.Attributes[FieldProperty.DecimalPrecision] = new DecimalPrecisionAttribute(12, 2);
                actApplication.ActFramework.Fields.Save(field);

 

See error below:

 

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Act.UI.PickList
  StackTrace:
       at Act.UI.PickList.DBFieldEditor.Dispose(Boolean disposing)
       at Act.UI.PickList.BasePickListControl.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Finalize()
  InnerException: 

 

Anthony Polk

CRM Computers

 

Employee
Posts: 1,163
Country: USA

Re: Custom Enitity Field Creation Error

[ Edited ]

It may be an issue with the entitiy you trying to add the field to. I was able to add a decimal field to contacts. The signature I used for the new FieldDesctiptor was different, but other than that the code is the same and doesn't throw the exception

 

 

try
{
FieldDescriptor newField = new FieldDescriptor("TestField",Act.Framework.RecordType.Contact, FieldDataType.Decimal);

newField.AllowEmpty = true; newField.Attributes[FieldProperty.DecimalPrecision] = new Act.Framework.Database.DecimalPrecisionAttribute(12, 2); ActApp.ActFramework.Database.LockDatabase(Act.Framework.DatabaseLockReason.SchemaChanges); ActApp.ActFramework.Fields.Save(newField); } catch (Exception x) { } finally { ActApp.ActFramework.Database.UnlockDatabase(); }

 

 

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 2
Country: USA

Re: Custom Enitity Field Creation Error

The exception is thrown after 23 fields are created in the entity.  Why?  The code works up to that point, then breaks.

 

Anthony Polk

CRM Computers