Community
Showing results for 
Search instead for 
Do you mean 
Reply

Adding a YESNO Field always gets me a SQL Timeout

New Member
Posts: 2
Country: United_Kingdom

Adding a YESNO Field always gets me a SQL Timeout

I am creating a plugin in C# to install new fields into ACT, all is working correctly with the exception of YESNO fields,

 

An example is here:

 

CustomEntityDescriptor descriptor = framework.CustomEntities.CreateCustomSubEntity(
InvoiceEntityDefinition.ENTITY_NAME, // unique name 
InvoiceEntityDefinition.ENTITY_DISPLAY_NAME, // display name
InvoiceEntityDefinition.PARENT_ENTITY,
// primary entities the custom sub-entity will be associated with
true, // do we want this in define fields (future use)
InvoiceEntityDefinition.ENTITY_DESCRPTION); // description of the entity
if (descriptor != null)
{
// create fields
CreateFields(descriptor);
}
)

//Then in CreateFields...

FieldDescriptor paidDescriptor = new FieldDescriptor("Paid", "COIPAID", descriptor,FieldDataType.YesNo);
Framework.Fields.Save(paidDescriptor);

 This works for every field I am creating unless they are YESNO in which case I just get a sqltimeout on the 

Framework.Fields.Save

method. 

 

Any ideas?

 

Regards

 

Jon

 

 

 

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Adding a YESNO Field always gets me a SQL Timeout

I always set the default values before the SAVE when creating a YESNO field?

 

 paidDescriptor.Attributes(FieldProperty.DefaultValue) = New DefaultValueAttribute(True)

 

-- Jim Durkin

New Member
Posts: 2
Country: United_Kingdom

Re: Adding a YESNO Field always gets me a SQL Timeout

[ Edited ]

Cheers Jim

 

Just tried your suggestion 

 

FieldDescriptor fieldOnHold = new FieldDescriptor("Sage On Hold", "SAGEONHOLD", RecordType.Company, FieldDataType.YesNo);
fieldOnHold.Attributes[FieldProperty.DefaultValue] = new DefaultValueAttribute(true);
try { framework.Fields.Save(fieldOnHold); }

but unfortunately I still get same behaviour - SQL Timeout on the Save method.

 

Regards

 

Jon