diff --git a/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls b/sfdx-source/apex-common/main/classes/fflib_SObjectUnitOfWork.cls index 1c38f657b6..d02ed40635 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); + } } }