} // isSubscribed /** * After Save * @param newRecord new * @param success success * @return success */ protected override Boolean AfterSave(Boolean newRecord, Boolean success) { if (success && newRecord && IsSubscribed()) { MInterestArea ia = MInterestArea.Get(GetCtx(), GetR_InterestArea_ID()); if (ia.GetR_Source_ID() != 0) { String summary = "Subscribe: " + ia.GetName(); // MSource source = MSource.Get(GetCtx(), ia.GetR_Source_ID()); MUser user = null; if (Get_TrxName() == null) { user = MUser.Get(GetCtx(), GetAD_User_ID()); } else { user = new MUser(GetCtx(), GetAD_User_ID(), Get_TrxName()); } // Create Request if (MSource.SOURCECREATETYPE_Both.Equals(source.GetSourceCreateType()) || MSource.SOURCECREATETYPE_Request.Equals(source.GetSourceCreateType())) { MRequest request = new MRequest(GetCtx(), 0, Get_TrxName()); request.SetClientOrg(this); request.SetSummary(summary); request.SetAD_User_ID(GetAD_User_ID()); request.SetC_BPartner_ID(user.GetC_BPartner_ID()); request.SetR_Source_ID(source.GetR_Source_ID()); request.Save(); } // Create Lead if (MSource.SOURCECREATETYPE_Both.Equals(source.GetSourceCreateType()) || MSource.SOURCECREATETYPE_Lead.Equals(source.GetSourceCreateType())) { MLead lead = new MLead(GetCtx(), 0, Get_TrxName()); lead.SetClientOrg(this); lead.SetDescription(summary); lead.SetAD_User_ID(GetAD_User_ID()); lead.SetR_InterestArea_ID(GetR_InterestArea_ID()); lead.SetC_BPartner_ID(user.GetC_BPartner_ID()); lead.SetR_Source_ID(source.GetR_Source_ID()); lead.Save(); } } } return(success); } // afterSave