Community
Showing results for 
Search instead for 
Do you mean 
Reply

how to add contact fields?

Accepted Solution Solved
Avid Listener
Posts: 83
Country: Malaysia
Accepted Solution

how to add contact fields?

Hi all,

 

how i can add column in contact table ?

 

thanks.


Accepted Solutions
Solution
Accepted by topic author jeffng
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 98
Country: United States

Re: how to add contact fields?

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,

Carlton Jones
Sage Software

View solution in original post


All Replies
Copper Contributor
Posts: 98
Country: United States

Re: how to add contact fields?

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,

 

 

Carlton Jones
Sage Software
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

tks carlton_james.
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

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

Nickel Super Contributor
Posts: 441
Country: UK

Re: how to add contact fields?

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

Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

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.

Solution
Accepted by topic author jeffng
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 98
Country: United States

Re: how to add contact fields?

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,

Carlton Jones
Sage Software
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

hi carlton,

 

thanks so much. Now i managed to add new fields to TBL_contact.

 

Thanks again.

Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

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.

Copper Contributor
Posts: 98
Country: United States

Re: how to add contact fields?

[ Edited ]

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?

Message Edited by Carlton_Jones on 04-13-2009 12:33 PM
Carlton Jones
Sage Software