我想要在联系人(例如电子邮件地址)上插入第一个电子地址作为主要地址,当插入地址时,第二个地址可能不会成为主要自动地址。创建第一个电子地址主
Herefore我想修改insert
方法在桌子上:
LogisticsElectronicAddress
public void insert()
{
ttsbegin;
if (!this.Location)
{
this.Location = LogisticsLocation::create('', false).RecId;
}
super();
this.updatePrimary(this.IsPrimary);
/* This is the modifications I made to check for an other primary address
if (!this.otherPrimaryExists())
{
this.IsPrimary = true;
}
*/
ttscommit;
this.invalidatePresenceInfo();
}
的方法otherPrimaryExists()
包含:
/// <summary>
/// Checks whether primary record exists for the location.
/// </summary>
/// <returns>
/// true if another electronic address record is primary for the location; otherwise, false.
/// </returns>
public boolean otherPrimaryExists()
{
LogisticsElectronicAddress logisticsElectronicAddress;
select firstonly RecId from logisticsElectronicAddress
where logisticsElectronicAddress.Location == this.Location &&
logisticsElectronicAddress.Type == this.Type &&
logisticsElectronicAddress.IsPrimary == true &&
logisticsElectronicAddress.RecId != this.RecId;
return logisticsElectronicAddress.RecId != 0;
}
的问题是,所有的电子地址正在成为主要的,而当我关闭表格中的所有主标记都将被删除。如何解决这个问题呢?