Using iBO to update an entry in the Name table

Hi,

I have a CContact entity that I am updating. At the same time I would like to update a field in the Name table as well as the Name_Reg table. I am able to get access to Name_Reg and update but I can not see the Name table. My code is
Get a valid contact from iBO then;
CExtTable t = contact.GetExtTableByName("NAME_REG");
CExtField f = t.Fields.Where(fn => fn.FieldName == "Pref_Phone").FirstOrDefault();
if(f !=null)
f.FieldValue = "TypeOfPhone";
etc...
contact.Save();
The above works fine. However, when I attempt the same using the below the Name table doesn't exist.
CExtTable t = contact.GetExtTableByName("NAME"); fn.FieldName == "CO_ID").FirstOrDefault();
f.FieldValue = "123456";
Is there a way to update the name table via iBO?

I'm using 15.1.1
Thanks in advance.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

CContact does update the

CContact does update the Name table. GetExtTableByName only works for user-defined tables.

For Name.CO_ID, you need to update CContact.InstituteContactId.

Eric Means
System Architect, ASI

I believe you're looking to

I believe you're looking to update the "InstituteContactId" property of the contact object, and then just call contact.Save().

I think CExtTable classes only let you get user defined tables. Since Name is a system table, you can't access it directly through those classes, and must instead rely on the contact properties.
Unfortunately, finding which properties match to which columns isn't very intuitive for some of the mappings.

I'm almost positive the "CO_ID" column matches to the "InstituteContactId" property of the CContact object, though.

Good luck!
Colin

Edit: Sir Means beat me to it. At least I'm right! :)

It would be nice to have a

It would be nice to have a document that lists which tables and fields correspond to which object(s) and properties. I think we started one, once upon a time. :(

Eric Means
System Architect, ASI

I found what I was looking for.

I ran a db trace when instantiating a contact and could see contact actually gets populated from the Name table! As it turns out CContact.InstituteContactId is CO_ID so simply setting that did exactly what I wanted. HTH someone else.

Whoops for the reply just noticed you posted before I did ;-)