3

I have an unlocked package with custom object Person__c and field Account__c as a lookup on the account.

I tried installing this package in an org where Person__c object is already available with Account__c field it failed with the following error

There is already a Child Relationship named Persons on Account.
Person__c.Account__c: There is already a Child Relationship named Persons on Account.

Is it the expected behavior or it is a platform bug?

I believed unlocked package could be used as a replacement of changeset or Ant-Migration tool as mentioned here : https://sfdc-db-gmail.github.io/unlocked-packages/faq-unlocked-pkgs.html

  • 2
    Does the unlocked package include the relationship field for the relationship? If not, this could cause problems. Without seeing your metadata, it'd be hard to know for sure. I have personally created unlocked packages with custom objects both as lookups and master-details to both standard and custom objects, and everything's worked fine. Could you possibly create a minimal copy of the metadata files so we could try it out ourselves? I know that's probably a huge ask, but it'd greatly help us help you if you could. – sfdcfox Jan 13 at 12:56
  • 1
    Could be the result of a modification in the relationship (e.g.: changing the type of relationship from lookup to master-detail) as well. The platform might try to create a new relationship with the same name. I'm just making a guess. OP can clarify if this is happening. – Renato Oliveira Jan 13 at 13:25
  • 1
    Did you activate Dev Hub and Unlocked Packages in this org? – Robert Sösemann Jan 13 at 14:50
  • 1
    Did you deploy Person__c with the field with another unlocked package? – muenzpraeger Jan 13 at 15:25
  • 1
    Thanks, everyone for suggestions. I found that org has account lookup with slightly different field api name and same child relationship name. So the packaging field was not replacing the account lookup and it was conflicting with chield relationship name. Resolution: I just removed the old Account lookup field from a custom object and my package got installed. – Sushant Srivastava Jan 14 at 8:56
1

Thanks, everyone for suggestions. I found that org has account lookup with slightly different field API name but same child relationship name. So the packaging field was not replacing the account lookup and it was conflicting with child relationship name.

Resolution: I just removed the old Account lookup field from the custom object (in subscriber org) and my package got installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.