Skip to content

Relationship is not created if both records are of the same type and are both new #279

Open
@JoelBrenstrum

Description

@JoelBrenstrum

We're currently using a much older version of fflib (~2014), We upgraded to the latest version and are experiencing this issue.

here is a simple example to repro, you will need to create an additional lookup on account.

fflib_ISObjectUnitOfWork uow = Application.UnitOfWork.newInstance();

Account a = new Account(Name= 'Test');
Account b = new Account(Name = 'Test2');
uow.registerRelationship(a, Account.Primary_Supplier__c,b);
uow.registerNew(a);
uow.registerNew(b);
uow.commitWork();

system.assert(a.Id != null);
system.assert(a.Primary_Supplier__c != null);
System.debug('SUCCESS');

2014 version we get SUCCESS
Latest version

"exceptionMessage": "System.AssertException: Assertion Failed",
"exceptionStackTrace": "AnonymousBlock: line 12, column 1"

any ideas or help would be greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions