Skip to Content
0
Former Member
Mar 11, 2009 at 11:37 AM

Setting default values for Contact Persons' fields

125 Views

Hello all,

I want to assign default values to some of the Contact Persons' fields, so that thay would be set when creating a new contact person.

To do it, I am catching an ItemPress (afteraction) event on item 112 of Bussiness Partners form and if it turns out that the user has presssed "New Record" on the list of contact persons, I am setting the default value like this:

if(
 (!ItemEvArg.pVal.BeforeAction)&&
 (ItemEvArg.pVal.ItemUID == "112")&&
 (ItemEvArg.pVal.EventType == BoEventTypes.et_ITEM_PRESSED)&&
 ItemEvArg.BubbleEvent
) {
 Matrix mtx = (Matrix)fm.Items.Item("112").Specific;
 if(ItemEvArg.pVal.Row == mtx.RowCount) {
	Matrix cpMtx = (Matrix)fm.Items.Item("107").Specific; //Ant: CP Matrix
	Column column = cpMtx.Columns.Item("12"); //Ant: Gender Column
	EditText cell = (EditText)column.Cells.Item(1).Specific;
	string s = cell.Value; //Test: value is read correctly
	cell.Value = "u0441u0440."; //But this line fails!
 }
}

The last line produces a vary strange exception: "Ivalid form item". How cat it be? I read the text from the same item one line above...

Thanks in advance,

Anton