public static ISaleStageHistory GetHistory(ISaleStageHistoryTarget saleStageHistoryTarget) { ISaleStageHistory result = null; if (GetLeadFrom(saleStageHistoryTarget as ILeadTarget, out result)) { return(result); } if (GetLeadFrom(saleStageHistoryTarget as IOpportunityTarget, out result)) { return(result); } return(null); }
public static void UpdateHistory(ISaleStageHistoryTarget saleStageHistoryTarget, IObjectSpace os) { if (saleStageHistoryTarget.History != null) { bool addHistoryRecord = true; foreach (LeadHistoryRecord historyRecord in saleStageHistoryTarget.History.LeadHistoryRecords) { if (historyRecord.SaleStage == saleStageHistoryTarget.SaleStage) { addHistoryRecord = false; } } if (addHistoryRecord) { LeadHistoryRecord historyRecord = os.CreateObject <LeadHistoryRecord>(); historyRecord.SaleStage = saleStageHistoryTarget.SaleStage; saleStageHistoryTarget.History.LeadHistoryRecords.Add(historyRecord); } } }