protected internal virtual void UpdateVariableInstance(IVariableInstanceEntity variableInstance, object value, IExecutionEntity sourceActivityExecution) { // Always check if the type should be altered. It's possible that the // previous type is lower in the type // checking chain (e.g. serializable) and will return true on // isAbleToStore(), even though another type // higher in the chain is eligible for storage. IVariableTypes variableTypes = Context.ProcessEngineConfiguration.VariableTypes; IVariableType newType = variableTypes.FindVariableType(value); if (newType != null && !newType.Equals(variableInstance.Type)) { variableInstance.Value = null; variableInstance.Type = newType; variableInstance.ForceUpdate(); variableInstance.Value = value; } else { variableInstance.Value = value; } Context.CommandContext.HistoryManager.RecordHistoricDetailVariableCreate(variableInstance, sourceActivityExecution, ActivityIdUsedForDetails); Context.CommandContext.HistoryManager.RecordVariableUpdate(variableInstance); }