mattaddy / SObjectFabricator

An SObject fabrication API to reduce database interactions and dependencies on triggers in Apex unit tests.
Other
91 stars 14 forks source link

fabrication for BranchUnitBusinessMember doesn't work #22

Closed AndreyDenissyuk closed 1 year ago

AndreyDenissyuk commented 2 years ago

Hello, when I run this simple code

Id bubmId = fflib_IDGenerator.generate(BranchUnitBusinessMember.SObjectType);

BranchUnitBusinessMember bubm = (BranchUnitBusinessMember) new sfab_FabricatedSObject(BranchUnitBusinessMember.class)
    .setField(BranchUnitBusinessMember.Id, bubmId)
    .toSObject();

I get this error

Error on line 452, column 1: sfab_FabricatedSObject.FieldDoesNotExistException: The field BranchUnitBusinessMember.Id does not exist
Class.sfab_FabricatedSObject.setDirectField: line 452, column 1
Class.sfab_FabricatedSObject.setField: line 233, column 1
AnonymousBlock: line 4, column 1

It happens with every field I want to add to this type of sobject, but only for BranchUnitBusinessMember, it is garanteed that this Sobject exists on my org and for sure it has fields that I try to add.

bobalicious commented 2 years ago

Have you tried setting the Id using the String 'Id' instead of the SObject Field for it?:

Id bubmId = fflib_IDGenerator.generate(BranchUnitBusinessMember.SObjectType);

BranchUnitBusinessMember bubm = (BranchUnitBusinessMember) new sfab_FabricatedSObject( BranchUnitBusinessMember.class )
    .set( 'Id', bubmId )
    .toSObject();
AndreyDenissyuk commented 2 years ago

same error

Error on line 452, column 1: sfab_FabricatedSObject.FieldDoesNotExistException: The field BranchUnitBusinessMember.Id does not exist
Class.sfab_FabricatedSObject.setDirectField: line 452, column 1
Class.sfab_FabricatedSObject.setField: line 249, column 1
Class.sfab_FabricatedSObject.set: line 129, column 1
AnonymousBlock: line 4, column 1
bobalicious commented 2 years ago

I have to apologise - I've looked into this, and I can't seem to set up a Scratch Org with a user that has Financial Services Cloud access that includes access to this object. Therefore I cannot replicate or test this.

If you can provide guidance on how to set that up, it would be greatly appreciated, and I can then look into the problem you're encountering.

What I have done:

Created scratch org using the following json:

{
  "orgName": "robertbaillie company",
  "edition": "Developer",
  "features": ["Communities",
    "ContactsToMultipleAccounts",
    "PersonAccounts",
    "IndustriesActionPlan",
    "DocumentChecklist",
    "FinancialServicesUser:10",
    "FinancialServicesInsuranceUser:10",
    "FinancialServicesCommunityUser:10",
    "FlowSites"],
  "settings": {
    "lightningExperienceSettings": {
      "enableS1DesktopEnabled": true
    },
    "securitySettings": {
      "passwordPolicies": {      }
    },
    "mobileSettings": {
      "enableS1EncryptedStoragePref2": false
    },
    "communitiesSettings": {
        "enableNetworksEnabled": true
    }
  },
  "objectSettings": {
    "account": {
       "defaultRecordType": "PersonAccount"
    }
 }
}

Installed the Financial Services packages using:

Added the following permissions sets to the current running user:

Created a permission set with direct access to BranchUnitBusinessMember.

Assigned that permission set the current running user.

I cannot seem to create a user with any of the Financial Services Cloud licences.

bobalicious commented 1 year ago

No response to original request after nearly 3 months, so closing