0

I need to add button (or action button, it doesn't really matter) to both Salesforce Classic and Lightning Experience mode on User layout but looks like it is not possible to add buttons to user layout

Custom buttons aren’t available on the User object or custom home pages.

Can I add some action to Lightning Experience at least? I do have Highlights panel on User Records Page in Lightning, but looks like there is no section "Salesforce Mobile and Lightning Experience Actions" in User Profile Layout or do I miss anything????

0

The only solution I found so far is the following.

Implementing custom component Buttons which implements flexipage:availableForRecordHome and force:hasRecordId interfaces

<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
    <lightning:button variant="brand" label="XXXX" onclick="{! c.action }"/>
</aura:component>

and contains one or several buttons.

In the lightning controller I can define the action for button click event.

({
    action : function(component, event, helper) {
        alert('x');
    }
})

Then I can put that component to User Records Page just beneath the Highlights Panel. enter image description here

and thus having it on user layout in Lightning Experience interface.

For Salesforce Classic interface I have to create Lightning Out application

<aura:application extends="ltng:outApp" >
    <aura:dependency resource="c:Buttons"/>
</aura:application>

Then Visualforce page which will use Lightning Out Application and Lightning Component

<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="User" >

    <apex:includeScript value="/lightning/lightning.out.js" />

    <div id="lightning" />

    <script>
        $Lightning.use("c:ButtonsOut", function() {
            // Write a function that creates the component on the page
          $Lightning.createComponent("c:Buttons",
          {},
          "lightning",
          function(cmp) {
          });
        });
    </script>

    <style>
        body{
            margin: 0;
        }
    </style>

</apex:page>

Then I have to modify layout and put page to the top available section of the User Layout.

Unfortunately, I can't put it above the Standards Fields section. Nor by point and click configuration neither by layout XML ANT Deployment Tool hacking.

enter image description here

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.