From 5bc74ad277124024acf5401f446221f4f76cbbe1 Mon Sep 17 00:00:00 2001 From: Jake Richter Date: Fri, 28 Apr 2023 11:38:37 -0400 Subject: [PATCH] fix from @dsurfleet --- .../apex-common/main/classes/fflib_SObjectUnitOfWork.cls | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls index 1c38f657b61..d02ed406351 100644 --- a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls +++ b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls @@ -702,6 +702,7 @@ public virtual class fflib_SObjectUnitOfWork { for (Schema.SObjectType sObjectType : m_sObjectTypes) { + m_relationships.get(sObjectType.getDescribe().getName()).resolve(); m_dml.dmlUpdate(m_dirtyMapByType.get(sObjectType.getDescribe().getName()).values()); } } @@ -897,7 +898,9 @@ public virtual class fflib_SObjectUnitOfWork public void resolve() { - this.Record.put( this.RelatedToField, this.RelatedTo.Id); + if (this.Record.get(this.RelatedToField) == null){ + this.Record.put( this.RelatedToField, this.RelatedTo.Id); + } } }