I have an app that creates and builds a custom button, using the metadata api (using the Apex Wrapper for the Salesforce Metadata API: https://github.com/financialforcedev/apex-mdapi). The button is then installed on various page layouts, also using the metadata api.
This all works fine in Classic. In Lightning, it works fine on some older test organizations that were created several months ago. However, it does not work on a new developer Organization that I just created.
In the organization in which it works, the button (named "List OnTask Workflows") is properly displayed in the page-level action menu, shown below.
In this organization, the button has been created by the app and installed into the page layout detailed section, as shown below:
We also see, that the button is listed in the Mobile & Lightning Actions section:
Now, in the new organization, in which this is not functioning, the button is not displayed in the Page-Level Action Menu:
However, as in the other organization, we see that the button has been installed and added to the page layout:
And, as in the other organization, the button shows up as a Mobile & Lightning Action.
The only difference between the two organizations that I can see, is that in the new Org, in which this doesn't work, the page layout configuration section titled "Salesforce Mobile and Lightning Experience Actions" is populated, whereas in the older org, in which this does work, that section is empty. I have done nothing to explicitly populate this section. I notice, in the new Org, that if I manually add the button in question to this section, then it starts to work properly.
Why would these organizations behave differently? I don't want to have to have my app users manually configure this button by adding it to the "Salesforce Moblie and Lightning Experience Actions" section of the page layout. Is there a way to have this added to this section with the metadata API?
Any insight is greatly appreciated
Best Answer
I have resolved this issue. The problem is related to the PlatformActionList metadata item that is associated with a page layout. If this list exists for a page, then the custom button needs to be added to the list. This can be done using the metadata api. I have implemented this and the problem is resolved.