protected virtual void SalesPerson_RowPersisting(PXCache cache, PXRowPersistingEventArgs e) { SalesPerson row = e.Row as SalesPerson; if (row != null) { if (row.ContactID.HasValue) { CS.Contact cnt = this.Contact.Current; if (cnt.ContactID == row.ContactID && cnt.ContactType != CS.Constants.ContactTypes.SalesPerson) { cnt.ContactType = CS.Constants.ContactTypes.SalesPerson; this.Contact.Cache.Update(cnt); } } } }
public virtual void SalesPerson_CreateNewContact_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { SalesPerson row = (SalesPerson)e.Row; if ((row.CreateNewContact ?? false) == true) { row.ContactID = null; } else { CS.Contact cnt = this.Contact.Current; if (cnt.ContactID == row.ContactID) { if (this.Contact.Cache.GetStatus(cnt) == PXEntryStatus.Inserted) { this.Contact.Delete(cnt); row.ContactID = null; } } } }