Community
Showing results for 
Search instead for 
Do you mean 
Reply

Create contact with address and email.

New Member
Posts: 2
Country: USA

Create contact with address and email.

I am trying to import records via a utility I am creating in C#. I can create the contact record, but I am unable to add an email.

 

In the following example the line updating the name works, but the command to update the email returns table not found. I am using Sage Act 2011

 

objContact.Fields["TBL_CONTACT.FULLNAME", Act.Framework.MutableEntities.FieldNameType.Real] = rows["txtForename"] + " " + rows["txtSurname"];
//objContact.Fields["ADDRESS", Act.Framework.MutableEntities.FieldNameType.Alias] = rows["txtEmail"];
objContact.Fields["TBL_CONTACT.EMAIL", Act.Framework.MutableEntities.FieldNameType.Display] = rows["txtEmail"];
objContact.Update();

 

 

 

Thanks

Copper Contributor
Posts: 42
Country: Germany

Re: Create contact with address and email.

[ Edited ]

Act! stores E-Mail addresses in an separate table (TBL_EMAIL)

You also have a mistake in your code: if you give the "fully qualified" field name (TBL_CONTACT.EMAIL) you woul have to set the second parameter to: Act.Framework.MutableEntities.FieldNameType.Real (as you did in your first line)

If you use Act.Framework.MutableEntities.FieldNameType.Display or Act.Framework.MutableEntities.FieldNameType.Alias you would only use the display-name of the field, e.g. "e-mail", "email" or maybe "mail" (don't know the exact name)

In your case this would look something like this:

objContact.Fields["EMAIL", Act.Framework.MutableEntities.FieldNameType.Alias] = rows["txtEmail"];

Or, if using Act.Framework.MutableEntities.FieldNameType.Real:

objContact.Fields["TBL_EMAIL.ADDRESS", Act.Framework.MutableEntities.FieldNameType.Real] = rows["txtEmail"];
New Member
Posts: 2
Country: USA

Re: Create contact with address and email.

Hi Thanks for replying

 

You're right the example I posted has errors in it - but that was the result of me hastily copying and pasting. I already tried those ideas.

 

I found a solution to this by looping over all the fields in the contact and discovered that the email field is split between BUSINESS_EMAIL and PERSONAL_EMAIL. This is a new database without any alterations so I am sure why this isn't in the SDK. Intuitively I also thought it would be TBL_EMAIL.ADDRESS.

 

It worked with the following code:

 

objContact.Fields["TBL_CONTACT.BUSINESS_EMAIL", Act.Framework.MutableEntities.FieldNameType.Real] = rows["txtEmail"]; 
                        

 


                       

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Create contact with address and email.

Just one more tiny point, I prefer to use Alias names for fields rather than the Real names since it does help to make the code easier to read, especially if have to deal with custom fields.
Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog