0

I would like to modify the layout of a Financial Account and persist the change in a managed package, but, as I have seen one cannot just pull the layout locally and then use it when creating a managed package.

What would be the way to tackle this situation?

More specific explanation:

I'm currently developing a package (let's call it X) which is also based on the Financial Services Cloud package. In this X package I want my Financial Account layout to be slightly different from the default one.(More specifically I want to introduce some new fields and some quick actions).

Can I make some changes to persist the layout of the financial account in my X package so after the installation the layout of the Financial Account will be how I wish it to be?

Currently, I've used

sfdx force:source:retrieve -x package.xml -n 'Financial Services Cloud'

This resulted in the creation of a new folder that contained everything from the FSC package, including the layout that I want to persist in my package. The issue is that I am not aware of how I could include this FSC layout in my package.

2
  • As it stands your question does not have enough details. Layouts can be pulled and can be packaged, in an unlocked (or 1GP unmanaged) or (1GP or 2GP) managed package - as long as they themselves don't come from another package. However, if you use a managed package (or 1GP unmanaged package) layouts in the package will be ignored if the layout is already installed; you cannot "upgrade" a layout and have that install in an update to the package. Please edit the question to explain the specific problem you face and what you have tried so far.
    – Phil W
    Commented Nov 2, 2021 at 13:34
  • Hello. I've completed the question with a more specific explanation. Hoping it's better now. @PhilW Commented Nov 2, 2021 at 13:41

1 Answer 1

1

You cannot include a layout from one package in another. You can, however, include another layout in your own package and simply change the Page Layout Assignments to use your layout (for the same object, i.e. the one from the other package) instead.

You will need to:

  1. Make sure you declare the package dependency appropriately if using 2GP.
  2. Understand that, once a layout is installed, any subsequent packaged updates to the layout do not get installed on the org when installing an "upgrade" for that package. I believe the one exception for this is for layouts from an (2GP) unlocked package which should be updated if you install a later version of the package.

Layouts have two parts to their names: the (namespaced) "name" for the layout itself and the (namespaced) name for the object the layout is for. Thus, you can take the extracted layout and update it to remove the package's namespace from the layout name, and perhaps change the layout "name", (but not the object name) then package this (effectively "cloned") layout.

Importantly, you can create any number of layouts for a given object, regardless of the package that object comes from, and then use Profile "Page Layout Assignments" to select which layout is used for a given object (or even record type for an object) for users assigned to that Profile.

6
  • Not sure if I understood exactly the solution as I'm relatively new to Salesforce. Does the solution imply creating a new layout which can then be used even though the Financial Account object is in the FSC package? Commented Nov 2, 2021 at 14:25
  • You can create as many layouts for a given object as you want; it is the Profiles' Page Layout Assignments that dictate which one is used for a given user.
    – Phil W
    Commented Nov 2, 2021 at 14:27
  • I added a little more detail. If you are new to Salesforce I recommend you look at the sfdx trailheads and the layouts trailhead
    – Phil W
    Commented Nov 2, 2021 at 14:34
  • Worked to create a layout which is in fact a clone to the one from FSC. When I retrieved the metadata for all layouts, it was also found there so I'm assuming it can safely be included in the package. Also will retrieve all assignment. Commented Nov 2, 2021 at 15:05
  • I may be stretching, but can someone retrieve a layout that also contains some proprietary LWC? or is that done by default? Commented Nov 2, 2021 at 15:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .