Enhanced Profile User Interface Salesforce

The enhanced profile user interface provides a streamlined experience for managing profiles. You can easily navigate, search, and modify settings for a profile. Salesforce org can use one profile user interface at a time.

To enable and disable enhanced profile user interface in Salesforce, check the below link

http://www.infallibletechie.com/2013/08/how-to-enable-and-disable-enhanced.html

Enhanced Profile User Interface enabled


Enhanced Profile User Interface disabled


How to get field values in onsuccess method of lightning:recordeditform?

Sample Code:

Component:

<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" >
    
    <div class="slds-box slds-theme_default">
        <lightning:recordEditForm recordId="003f200002R3OtxAAF" objectApiName="Contact" onsuccess="{!c.callSuccess}">
            <lightning:messages />
            <lightning:inputField fieldName="FirstName" />
            <lightning:inputField fieldName="LastName" />
            <lightning:inputField fieldName="Email" />
            <lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update"/>                          
        </lightning:recordEditForm>
    </div>
    
</aura:component>

Controller:

({
    
    callSuccess : function ( component, event, helper ) {
        
        var payload = event.getParams().response;
        var objJSON = JSON.parse(JSON.stringify(payload));
        alert(objJSON["fields"]["Email"]["value"]);
        alert(objJSON["fields"]["FirstName"]["value"]);
        alert(objJSON["fields"]["LastName"]["value"]);
        alert(objJSON["fields"]["AccountId"]["value"]); 
        
    }

})


Output:








How to assign users already assigned to roles to a new role or change their role?

I am writing this post since I saw many admins asking how to assign already assigned users to a new role. Since by default the list view is Unassigned Users, many are manually editing the users to assign them to the new role or change their role.

1. Go to Roles.


2. Click Assign.


3. Select the All Users list view or prior to this create a list view with your filter conditions.


Sample Inbound REST API Test Class in Salesforce

Sample REST Class

@RestResource(urlMapping='/Account/*')
global with sharing class SampleRest {
  
    @HttpGet
    global static Account doGet() {
        RestRequest req = RestContext.request;
        String acctId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
        Account result = [SELECT Id, Name FROM Account WHERE Id =: acctId];
        return result;
    }
  
    @HttpPost
    global static String doPost(String name, String descrp) {
        Account a = new Account(Name = name, Description = descrp);        
        insert a;
        return a.Id;
    }

    @HttpDelete
    global static void doDelete() {
        RestRequest req = RestContext.request;
        String memberId = req.requestURI.substring(req.requestURI.lastIndexOf('/') + 1);
        Account memb = [SELECT Id FROM Account WHERE Id = :memberId];
        delete memb;
    }
    
}

Sample Test Class

@isTest
private class SampleRestTest {

    @testSetup
    static void dataSetup() {
        Account acc = new Account(Name = 'Testing');
        insert acc;
    }

    static testMethod void testGet() {
        Account acc = [ SELECT Id FROM Account LIMIT 1 ];
        RestRequest req = new RestRequest(); 
        RestResponse res = new RestResponse();             
        req.requestURI = '/services/apexrest/Account/' + acc.Id;
        req.httpMethod = 'GET';
        RestContext.request = req;
        RestContext.response= res;
        Account acctResp = SampleRest.doGet();
        system.assertEquals(acctResp.Name, 'Testing');
    }
    
    static testMethod void testPost() {
        RestRequest req = new RestRequest(); 
        RestResponse res = new RestResponse();             
        req.requestURI = '/services/apexrest/Account/';
        req.httpMethod = 'POST';
        RestContext.request = req;
        RestContext.response= res;
        String acctId = SampleRest.doPost('Test', 'Testing');
        Account acc = [ SELECT Id, Name, Description FROM Account WHERE Id =: acctId ];
        system.assertEquals(acc.Name, 'Test');
        system.assertEquals(acc.Description, 'Testing');
    }
    
    static testMethod void testDelete() {
        Account acc = [ SELECT Id FROM Account LIMIT 1 ];
        RestRequest req = new RestRequest(); 
        RestResponse res = new RestResponse();             
        req.requestURI = '/services/apexrest/Account/' + acc.Id;
        req.httpMethod = 'DELETE';
        RestContext.request = req;
        RestContext.response= res;
        SampleRest.doDelete();
        system.assertEquals( [ SELECT COUNT() FROM Account ], 0);
    }
    
}


Mass Quick Actions in Salesforce Lightning

1. Go to Object Manager.

2. Select the Object in which you want Mass Quick Action.

3. Select Buttons, Links, and Actions.


4. Click New to create one.

5. Select Create New Record or Update a record. In my example I have used Update a record.


6. Select the fields that should be available to the users to update.


7. Go to Search Layouts.


8. Click Edit next to List View.


9. Add the Quick Action created.


10. Go to the object tab. Select list view except recent and select the records and click the Quick Action.


11. Select the value to update. In this example I have selected support queue.


How Single Sign On user download and install Salesforce Data Loader?

1. Use the below links to download Data Loader.

Windows OS:
https://login.salesforce.com/dwnld/DataLoader/ApexDataLoader.exe

MAC OS:
https://login.salesforce.com/dwnld/DataLoader/ApexDataLoader.dmg

2. Once installed use the Data Loader shortcut icon in the Desktop.

3. Select the action(Insert or update or upsert, etc).

4. Select the Environment(Sandbox or Production) and click Login Button.


5. Click Use Custom Domain.


6. Enter the domain and click Continue.


7. Click Allow button.


8. Check whether the login in successful.


How to create and share Report Folders in Salesforce Lightning?

To create the Report Folder:

1. Go to Reports tab.

2. Click New Folder button.


3. Enter Label and Name.

To share the Report Folders:

1. Go to Reports tab.

2. Select All Folders.


3. Select Share from the action menu.


4. Select User or Roles or Roles and Subordinates or Public Group in Share With. Select the name from the Names. Select the Access level from Access menu. Click the Share button to share.


Lightning for Gmail in Salesforce

Get data from rep’s Gmail, Google Contacts, and Google Calendar into Salesforce. Reps can view and search relevant Salesforce records from their Gmail, then relate important email to Salesforce records using Lightning for Gmail.

1. Go to Lightning for Gmail and Sync Settings.


2. Enable Lightning for Gmail.


3. Add Salesforce Lightning for Gmail Google Chrome extension.

4. Open Gmail in Google Chrome browser.

5. Click Log In to Salesforce.


6. Click Use Custom Domain if your organization is SSO enabled or enter username and password and click Log In.


7. Enter the Custom Domain. Click continue.

8. Click Continue to access.


9. Enter Google Email credentials.

10. Click Continue.

11. Link to Salesforce.



Test class in Developer console always shows None issue

1. Go to Apex Test Execution.


2. Click "Options".


3. Disable Store Only Aggregated Code Coverage.


Email to Case Assignment Rule not firing

This issue can be solved by making the Case Owner field blank in Case Settings.

Case Owner field is used to find the owner of the case, which can be either an individual user or a queue. This field is optional.

Note:
1. If you specify a case owner, auto-assignment rules are ignored.
2. You can’t delete a queue that a routing address refers to. Either delete the routing address, or edit the routing address settings to point to a different queue.


How to Disable and Enable button in lightning:datatable?

Component:

<aura:component implements="force:appHostable"
    controller="AccountListController">
                
    <aura:attribute type="AccountWrapper[]" name="acctList"/>
    <aura:attribute name="mycolumns" type="List"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.fetchAccounts}"/>
    
    <lightning:datatable data="{! v.acctList }" 
                         columns="{! v.mycolumns }" 
                         keyField="id"
                         hideCheckboxColumn="true"
                         onrowaction="{!c.viewRecord}"/>

</aura:component>

Component Controller:

({
    
    fetchAccounts : function(component, event, helper) {
        component.set('v.mycolumns', [
            {label: 'Account Name', fieldName: 'accName', type: 'text'},
            {label: 'Industry', fieldName: 'accIndustry', type: 'text'},
            {label: 'Type', fieldName: 'accType', type: 'text'},
            {label: 'Active?', fieldName: 'accActive', type: 'text'},
            {type: "button", typeAttributes: {
                label: 'View',
                name: 'View',
                title: 'View',
                disabled: { fieldName: 'isActive'},
                value: 'view',
                iconPosition: 'left'
            }}
        ]);
        var action = component.get("c.fetchAccts");
        action.setParams({
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.acctList", response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    },
    viewRecord : function(component, event, helper) {
        var recId = event.getParam('row').accId;
        var actionName = event.getParam('action').name;
        if ( actionName == 'View') {
            var viewRecordEvent = $A.get("e.force:navigateToURL");
            viewRecordEvent.setParams({
                "url": "/" + recId
            });
            viewRecordEvent.fire();
        }
    }
    
})

Apex Classes:

public class AccountWrapper {
        
    @AuraEnabled
    public String accName;
    @AuraEnabled
    public Boolean isActive;
    @AuraEnabled
    public String accIndustry;
    @AuraEnabled
    public String accType;
    @AuraEnabled
    public String accActive;   
    @AuraEnabled
    public String accId; 

}

public class AccountListController {
    
    @AuraEnabled
    public static List < AccountWrapper > fetchAccts() {
        List < AccountWrapper > listAcctWrapper = new List < AccountWrapper >();
        for ( Account acc : [ SELECT Id, Name, Industry, Type, Active__c FROM Account LIMIT 10 ] ) {
            AccountWrapper AccountWrap = new AccountWrapper();
            AccountWrap.accName = acc.Name;
            AccountWrap.isActive = acc.Active__c == 'Yes' ? true : false;
            AccountWrap.accIndustry = acc.Industry;
            AccountWrap.accType = acc.Type;
            AccountWrap.accActive = acc.Active__c;
            AccountWrap.accId = acc.Id;
            listAcctWrapper.add(AccountWrap);
        }
        return listAcctWrapper;
    }
        
}

Output:



Salesforce Toast event in Lightning Component

Toast displays a message below in the header at the top of the view.

Toast are the message box or you can say notification which developer can show according to action of the user. Let’s understand the attributes of toast.

Attributes:

mode is used to specify how the toast will disappear.

Three types of mode:
dismissible :  Toast will disappear either by user action or on complete of specified duration.
pester :  Toast will disappear on complete of specified duration. Close button will not appear.
sticky :  Toast will disappear by user action.

messageTemplate :  If we want to override the message which is specified in message attribute we can use this attribute along with messageTemplateData.
messageTemplateData : To show the overridden message you must use this attribute.

type :  Four types
info
success
warning
error

Sample Code:

Component:

<aura:component implements="force:appHostable"
                controller="Sample">

    <div class="slds-box slds-theme_default">
        <lightning:button variant="brand" label="Click Info" onclick="{!c.showToastInfo}"/><br/><br/>  
        <lightning:button variant="brand" label="Click Sucess" onclick="{!c.showToastSuccess}"/><br/><br/>
        <lightning:button variant="brand" label="Click Error" onclick="{!c.showToastError}"/><br/>
    </div>
    
</aura:component>

Component Controller:

({ 
    showToastInfo: function(component, event, helper) { 
        var showToast = $A.get("e.force:showToast"); 
        showToast.setParams({ 
            title : 'Testing Toast!!!', 
            message : 'Record Saved Sucessfully.' ,
            type : 'info',
            mode : 'dismissible'
        }); 
        showToast.fire(); 
    },
    showToastSuccess: function(component, event, helper) { 
        var showToast = $A.get("e.force:showToast"); 
        showToast.setParams({ 
            title : 'Testing Toast!!!', 
            message : 'Record Saved Successfully.' ,
            type : 'success',
            mode : 'pester'
        }); 
        showToast.fire(); 
    } ,
    showToastError: function(component, event, helper) { 
        var showToast = $A.get("e.force:showToast"); 
        showToast.setParams({ 
            title : 'Testing Toast!!!', 
            message : 'Record Not Saved due to error.' ,
            type : 'error',
            mode : 'sticky',
            messageTemplate : '{0} - {1}',
            messageTemplateData : ['Salesforce', 'Toasting Demo']
        }); 
        showToast.fire(); 
    } 
}) 

Output:


How to avoid reminder popup in Salesforce?

Organization Level:

1. Go to Activity Settings.


2. Deselect Enable Activity Reminders under Activity Settings Salesforce.


User Level:

1. Go to My Settings or Activity Reminders under My Personal Information.


(or)


2. Disable Show reminders under Activity Reminders.