03-29-2009 06:38 PM
Hi all,
how i can add column in contact table ?
thanks.
04-06-2009 08:43 AM
I think all you are missing is:
using Act.Framework.Database;
or....
Act.Framework.Database.FieldDataType eFieldType = Act.Framework.Database.FieldDataType.Character;
Hope this helps,
03-30-2009 09:31 AM
From ACT! SDK Samples Reference (aka Code Samples.chm)
//Example 2 //This example adds a field to the Contact Database 50 characters long with a name of "MyFieldName". string sFieldName = "MyFieldName"; FieldDataType eFieldType = FieldDataType.Character; //Lock the database prior to creating field. ActFwk.Database.LockDatabase(Act.Framework.DatabaseLockReason.General); //Describe and create the new field. FieldDescriptor fdField; try { fdField = new FieldDescriptor(sFieldName, Act.Framework.RecordType.Contact,eFieldType); //The field gets created with the name you give it as the display name. The column name //will be the name you give preceded by a 4 char prefix related to the table and a string //of alpha numerics appended by the system, ie: CUST_Test1_06491140. ActFwk.Fields.Save(fdField); } catch { throw new Exception("An error occurred while adding the field"); } //These are the only properties that can be set along with the field length when appropriate to type. fdField.IsPrimary = false; fdField.IsTracked = false; fdField.AllowEmpty = false; //For character type fields, set the maximum length. if (eFieldType==FieldDataType.Character) { fdField.Attributes[FieldProperty.Length] = new LengthAttribute(50); } ActFwk.Database.UnlockDatabase();
Hope this helps,
03-30-2009 06:12 PM
03-30-2009 06:52 PM
hi carlton_james i encountered errors while compiling.
Error 2 The type or namespace name 'FieldDataType' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Jeff Ng\Documents\ACT\Framework 5.0 Gold 2008\UbsaccConnector\Form1.cs 173 13 UbsaccConnector
03-31-2009 03:24 AM
You are missing a reference to one of the dlls. It will be one of the main ones like act.framework.dll but I couldn't tekl you exactly which one off the top of my head sorry. Generally you would need at a minimum:
Act.framework.dll
act.shared.collections.dll
act.ui.dll
act.ui.core.dll
Tom
04-02-2009 11:07 PM
Hi ,
I still have missing assembly even i had add references.
using Act.UI;
using Act.Framework;
using Act.Framework.Contacts;
using Act.UI.Contacts;
using System.Xml.Serialization;
using Act.Shared.Collections ;
using Act.UI.Core ;
FieldDataType eFieldType = FieldDataType.Character;
error message :Error 4 The type or namespace name 'FieldDataType' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Jeff Ng\Documents\Visual Studio 2008\Projects\test\test\Form1.cs 273 13 test
Please advice. Thanks.
04-06-2009 08:43 AM
I think all you are missing is:
using Act.Framework.Database;
or....
Act.Framework.Database.FieldDataType eFieldType = Act.Framework.Database.FieldDataType.Character;
Hope this helps,
04-08-2009 08:29 PM
hi carlton,
thanks so much. Now i managed to add new fields to TBL_contact.
Thanks again.
04-12-2009 10:30 PM
why after i create cust_id fields but when i tried to insert data it prompt me error message.
it cant find the cust_id fields.
Thanks.
04-13-2009 09:31 AM - edited 04-13-2009 09:33 AM
The contact id (and some other system fields) are read only.
Generally to modify system fields you'll need to perform SDK calls rather than attempting to write to the database directly.
Are you talking about a field you created?