You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've gotten success using multiple UnitOfWorks in your same scenario, i.e. setting relationships on the same object, e.g.
//Create a UnitOfWork to handle the object relationships and dmls
fflib_SObjectUnitOfWork uow = (fflib_SObjectUnitOfWork) Application.UnitOfWork.newInstance(new List<SObjectType>{Account.SObjectType});
fflib_SObjectUnitOfWork uow2 = (fflib_SObjectUnitOfWork) Application.UnitOfWork.newInstance(new List<SObjectType>{Account.SObjectType});
//Create SObjects in memory
Account a = new Account(Name= 'Test');
Account b = new Account(Name = 'Test2');
//insert records
uow.registerNew(b);
uow2.registerNew(a, Account.Primary_Supplier__c,b);
uow.commitWork();
uow2.commitWork();
In scenarios where the SObjectTypes are different, I've been able to use one uow, but in this case, I've had to use multiple (one for each level of the same SObjectType)
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.
2014 version we get
SUCCESS
Latest version
any ideas or help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: