Problem Saving User defined Tables via the iBOs.

I execute the following block of code

contactToSave.SetInstituteContactId(_ContactId, false, false);

CExtTable t = contactToSave.GetExtTableByName("Name_Demo2");

t.GetInstance(0);

CExtField spouse = t.GetField("Spouse");

spouse.FieldValue ="xxxxx";

CExtField school = t.GetField("School_Attended");

school.FieldValue = "xxxxx";

contactToSave.Save();

The Save method process without error, but when I go to look at the table in SQL, there are no values created in it?  Is there something I'm not doing correctly?

 

Comment viewing options

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

Is Name_Demo2 a

Is Name_Demo2 a mutli-instance table?  If not, you don't need the line with the call to GetInstance().  If so, make sure the index of 0 actually contains the row you want to update.  Also, I know iBO has sometimes had problems with multi-instance tables when your contact has an entry in the table with a SEQN of "0" - if your contact has one, you might update it via SQL to be a valid sequence number.

Other than that, this looks correct.  I usually call contactToSave.Validate() before calling Save, but I don't think it's necessary.  Are you able to update something simple like FirstName by setting contactToSave.FirstName and calling save?

Thanks for the reply

I removed the GetInstance() call and the information has now shown up in the table.