看到我无法解决的奇怪行为。任何建议表示赞赏。我有一张绝对填充了键值对的地图。然后,我尝试在更新之前将地图值传递给每个提供的地图方法的列表。我立即这样做,由于某种原因,我丢失了刚刚传递给列表的记录中的值,进而无法更新它。代码和调试日志如下;
代码(已删除调试行):
if(!posMap.isEmpty()){
List<Position__c> posUpdates = new List<Position__c>();
posUpdates = posMap.values();
update posUpdates;
}
调试日志:
USER_DEBUG|[403]|DEBUG|posUpdate record -->Position__c:{Affiliation_Final__c=a03N0000000mQEKIA2, Position_Type__c=Warden, Id=a07N0000000iA6lIAE}
11:21:17.825 (825365000)|SYSTEM_METHOD_EXIT|[403]|System.debug(ANY)
11:21:17.825 (825386000)|SYSTEM_METHOD_ENTRY|[404]|String.valueOf(Object)
11:21:17.825 (825402000)|SYSTEM_METHOD_EXIT|[404]|String.valueOf(Object)
11:21:17.825 (825413000)|SYSTEM_METHOD_ENTRY|[404]|System.debug(ANY)
11:21:17.825 (825418000)|USER_DEBUG|[404]|DEBUG|id ->null
11:21:17.825 (825422000)|SYSTEM_METHOD_EXIT|[404]|System.debug(ANY)
11:21:17.825 (825439000)|SYSTEM_METHOD_ENTRY|[405]|String.valueOf(Object)
11:21:17.825 (825453000)|SYSTEM_METHOD_EXIT|[405]|String.valueOf(Object)
11:21:17.825 (825464000)|SYSTEM_METHOD_ENTRY|[405]|System.debug(ANY)
11:21:17.825 (825468000)|USER_DEBUG|[405]|DEBUG|Affiliation_Final__c ->null
11:21:17.825 (825472000)|SYSTEM_METHOD_EXIT|[405]|System.debug(ANY)
11:21:17.825 (825516000)|DML_BEGIN|[406]|Op:Update|Type:Position__c|Rows:2
11:21:17.826 (826821000)|DML_END|[406]
11:21:17.826 (826971000)|EXCEPTION_THROWN|[406]|System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified