Community
Showing results for 
Search instead for 
Do you mean 
Reply
Accepted Solution

how to add contact fields?

Highlighted
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

Hi carlton,

 

how i know it is read-only or full access ? i got actdiag.exe but i cant see that got stated permissions.

And its the new fields i just created.

 

Thanks.

Highlighted
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

Hi Carlton , As i checked the fields cust_id is full access permissions.

 

may i know why i cant add data to the new column ? thanks so much.

Highlighted
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

Hi Carlton,

 

Here is my code.

 

//MessageBox.Show(Convert.ToString(b));

 if (b == true)

{

Contact NewContact;

ContactList cList;

ContactFieldDescriptor cField;

NewContact = oFram.Contacts.CreateContact();

NewContact.Fields[
"TBL_CONTACT.COMPANYNAME", true] = custno;

NewContact.Fields["TBL_CONTACT.FULLNAME", true] = name;NewContact.Fields[

"TBL_CONTACT.BUSINESS_EMAIL", true] = e_mail;

NewContact.Fields["TBL_CONTACT.CONTACTWEBADDRESS", true] = web_site;NewContact.Fields[

"TBL_CONTACT.MOBILE_PHONE", true] = phonea;

NewContact.Fields["TBL_CONTACT.FAX_PHONE", true] = fax;NewContact.Fields[

"TBL_CONTACT.BUSINESS_PHONE", true] = phone;

NewContact.Fields["TBL_CONTACT.BUSINESS_LINE1", true] = add1;NewContact.Fields[

"TBL_CONTACT.BUSINESS_LINE2", true] = add2;

NewContact.Fields["TBL_CONTACT.BUSINESS_LINE3", true] = add3;NewContact.Fields[

"TBL_CONTACT.cust_id", true] = cust_id;

cList = oFram.Contacts.GetDuplicateContacts(NewContact);

if (cList.Count > 0)

{

MessageBox.Show(cList.Count.ToString() + " duplicates found. No dupes allowed");

}

else

{

NewContact.Update();

Reccount = Reccount++;

// MessageBox.Show("Contact added");

}

}

Highlighted
Nickel Super Contributor
Posts: 441
Country: UK

Re: how to add contact fields?

Hi Jeff,

Is the field definately in TBL_CONTACT, act creates spillover tables after a while, this means you may have other tables as well, have a flick through your fields report from actdiag and you should see them.  Otherwise you can use something like the following to find the field (vb sorry)

Private Sub SetContactField(ByVal contact As Act.Framework.Contacts.Contact, ByVal value As Object) 'this sets the cust_id field to the value specified Try 'we find the fields true name from its display name 'to work around the spillover table issues contact.Fields(FindField("cust_id"), True) = value contact.Update() MsgBox("Save Successful") Catch ex As Exception MsgBox(ex.Message) End Try End Sub Private Function FindField(ByVal displayName As String) As String 'this function finds a fields true name give its display name Dim cFields() As Act.Framework.Contacts.ContactFieldDescriptor cFields = actfwk.Contacts.GetContactFieldDescriptors For Each field As Act.Framework.Contacts.ContactFieldDescriptor In cFields If field.DisplayName = displayName Then Return field.Name End If Next End Function

Tom

Highlighted
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

Hi Tdavis,

 

i using c# and this code returned 92 fields.  but how come the column_name is not cust_id and "CUST_Cust_id_113633152" ?

Ooo i just read the API documentation and it will auto append alphanumerics to the column name. But can i have choice not to append extra alphanumerics ? Thanks.

 

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.

 

 

string strPath = txtActpath.Text; //path to your dB's PAD file;

string strUser = txtusername.Text;//user name;

string strPass = txtPassword.Text;//password;

 

Act.Framework.
ActFramework ActFwk = new Act.Framework.ActFramework();

ActFwk.LogOn(strPath, strUser, strPass);

ContactFieldDescriptor[] cFields = ActFwk.Contacts.GetContactFieldDescriptors();

MessageBox.Show(cFields.Length.ToString() + " fields returned.");

 

Highlighted
Nickel Super Contributor
Posts: 441
Country: UK

Re: how to add contact fields?

This is beacuse the field has hit a spill over table.  You need to work around this by using display names etc, this is why I reccoment the function in the sample below, this will always find the true name (with the numbers) given a display name.

 

Tom 

Highlighted
Avid Listener
Posts: 83
Country: Malaysia

Re: how to add contact fields?

Hi Tdavis,

 

Thanks for your reply.