示例#1
0
        private void UpsertHistoryRecord(IOrganizationService service, bool isCreate, Entity historyTBC, Entity target)
        {
            var latestHistoryId = GetLatestHistoryId(service, target.LogicalName, target.Id);
            var addedGuid       = new Guid();

            if (!target.Contains("statecode") || isCreate)
            {
                addedGuid = SDKHelper.Create(service, historyTBC);
            }

            if (!isCreate && addedGuid != default(Guid))
            {
                if (latestHistoryId != default(Guid))
                {
                    UpdateLatestHistory(service, latestHistoryId);
                }
            }
        }