January 31, 2019

Salesforce Interview Questions with Answers Part 54

1. Is Single Sign-On Enabled  permission in profile 

Is Single Sign-On Enabled permission under System permission is available only when Delegated Authentication is enabled.
To enable Delegated Authentication, contact Salesforce.com support.

2. When does Workflows trigger even though subsquently meet criteria is selected.

Workflow rules are triggered when a standard or custom object in a master-detail relationship is re-parented, even if the object's evaluation criteria is set to Evaluate the rule when a record is: created, and any time it’s edited to subsequently meet criteria.

3. Custom Lightning Page Template Component 

Every standard Lightning page is associated with a default template component, which defines the page’s regions and what components the page includes. Custom Lightning page template components let you create page templates to fit your business needs with the structure and components that you define. Once implemented, your custom template is available in the Lightning App Builder’s new page wizard for your page creators to use.

4. What is the Relationship Between Order Object and Opportunity and Quote Objects?

Currently, the objects are independent and Orders does not relate to Opportunities or Quotes.

In contrast to an Opportunity, the Order represents the actual sale/purchase.  There could be multiple Orders per Opportunity or Quote depending on your business requirements.  You may also receive Orders from an external e-commerce system.  By creating a separate Order with Order Products, you can integrate this object with your back-office / ERP and track the status of the Order as it is fulfilled/provisioned after the sale.  You could also track additional fields on the Order / Order Product as needed by operations for processing.

5. What is a Change Data Capture (CDC) event?
A CDC event, or change event, is a notification that Salesforce sends when a change to a Salesforce record occurs as part of a create, update, delete, or undelete operation. The notification includes all new and changed fields, and header fields that contain information about the change. For example, header fields indicate the type of change that triggered the event and the origin of the change. Change events support all custom objects and a subset of standard objects.

When to use Change Data Capture
Use change events to:

Receive notifications of Salesforce record changes, including create, update, delete, and undelete operations.
Capture field changes for all records.
Get broad access to all data regardless of sharing rules.
Get information about the change in the event header, such as the origin of the change, which allows ignoring changes that your client generates.
Perform data updates using transaction boundaries.
Use a versioned event schema.
Subscribe to mass changes in a scalable way.
Get access to retained events for up to three days.

https://developer.salesforce.com/blogs/2018/08/what-is-change-data-capture.html

6. Is SSO enabled permission in profiles
Is Single Sign-On Enabled permission under System permission is available only when Delegated Authentication is enabled.
To enable Delegated Authentication, contact Salesforce.com support.

7. What happens if Chatter is disabled in Chatter Settings?

In Salesforce Classic, Global Search will be hidden for all the users. Users will lose all Chatter features.
Process automation using Chatter will fail.

There is no Search Settings in Lightning Experience.

8. How to handle DMLs with call outs?

You cannot perform a DML operation prior to a callout. All the DML operations should be invoked only after you are done with callouts.So, make a webservice callout first and then save the request.

9. What is concurrent API Request limit in Salesforce?
A long-running API request(inbound to Salesforce) is one that takes over 20 seconds. Salesforce allows only 25 long-running to run at a time in an organization.

Concurrent Apex and Concurrent API limits are different.

Check this for Concurrent Apex Limit - http://www.infallibletechie.com/2018/03/what-is-concurrent-request-limit-in.html

10. How PushTopics are subscribed?

PushTopic name is used for subscription. Name is case sensitive. URL will be topics/Topic-Name

11. Inherited Sharing in Apex

There is a distinct difference between an Apex class that is marked with inherited sharing and one with an omitted sharing declaration.If the class is used as the entry point to an Apex transaction, an omitted sharing declaration runs as without sharing. However, inherited sharing ensures that the default is to run as with sharing. A class declared as inherited sharing runs only as without sharing when explicitly called from an already established without sharing context.

12. Platform event disadvantage

But, it’s important to remember that #PlatformEvents aren’t tied to the transaction so they can be published and delivered before the transaction commits, meaning the data might not be available.

13. Sorting in Batch Apex

"Batches of records are not guaranteed to execute in the order they are received from the start method."

When we slice the records into batches, the order in which it is processed is not guaranteed. So, when you pass the records to the execute in an order, and when it is divided into multiple batches, salesforce do not process the records in the same order.

14. In which mode transactions in one batch Apex job run, parallel or series?

They run in series.

15. StandardController getRecord() in Apex Class

A standardcontroller's getRecord() will only contain the fields referenced in the visualforce page you're using it on. The standard controller addFields(List) method (docs) allows you to extend this to the fields you need in your apex code.

cont.addFields(new List<String>{'Assigned_to_Partner__c'});

16. Leads to Person Account during Lead Conversion

With person accounts enabled, you can convert leads to either person accounts or business accounts. Leads that don't have a value in the Company field are converted to person accounts. Leads that do have a value in the Company field are converted to a business account.

17. NotifyForFields in PushTopic

Specifies which fields are evaluated to generate a notification.
Valid values:
1. All ( all fields )
2. Referenced (default) ( fields in both Select and Where )
3. Select ( fields in Select )
4. Where ( fields in Where )

18. Relationship fields in PushTopic Query

Relationships aren’t supported, but you can reference an ID:
Example query: SELECT Id, Contact.Account.Name FROM Contact
Error message: INVALID_FIELD, relationships are not supported

January 25, 2019

Salesforce Optimizer Report is not received

If Salesforce Optimizer Report is not received, check your Files tab. Salesforce adds the file to the Files.


January 21, 2019

Salesforce Spring '19 Release Summary

Jump Right into Your Most Important List View with Pinned Lists
Do you have a go-to list view that you want to load as your default list? Now you can. With pinned lists, all users can make any list their new default. 

Print a Record Page
Print key details and related lists from a record page in Lightning Experience, just as in Salesforce Classic. Specify record details visibility on the printable page and print the page from the browser. This feature is available for all users, for Account, Campaign, Case, Contact, Contract, Lead, Opportunity, Order, and custom objects.
Print a Record Page Print key details and related lists from a record page in Lightning Experience, just as in Salesforce Classic. Specify record details visibility on the printable page and print the page from the browser. This feature is available for all users, for Account, Campaign, Case, Contact, Contract, Lead, Opportunity, Order, and custom objects.

See Which Objects Were Searched at a Glance
On the search results page, immediately see the number of results found for each object searched. Previously, it wasn’t clear which objects were searched, so it was hard to know what to check next. Now, there’s no more wasted time guessing. 
On the Top Results page, we show you the best results for the objects you use most. If you don’t find what you’re looking for, you can check other objects for results by clicking the object names in the sidebar.
When there are more than five results, we show “5+” on the Top Results page. Click the object name to see the full list of results and the count.

Update to Retention Limit for Field History Data
Salesforce guarantees to retain your field history data for up to 18 months through your org, and up to 24 months via the API. As announced in Winter ’19, starting in Spring ’19, we begin the process of removing field history data older than 24 months. Because of the rolling nature of mass deletes, the data might still be available for some time after Spring ’19.
Remove an Account Team in Lightning Experience
When an account team isn’t needed, the account owner can remove the entire team with a click. Previously, you had to remove a team one member at a time.

Use Thanks Badges in Lightning Experience (Pilot)
Sing your praises from the mountaintops, or at least from your Chatter feed. Thanks badges are now available in Lightning Experience. Let your coworkers know how much you value them with our suite of thanks badges. 

Check Tasks Off Your List with a Click
Closing tasks isn’t a burdensome task anymore. Instead of scrolling through the Status dropdown list, sales reps can mark tasks complete with one click.  

Say Goodbye to Unsafe Characters in Notes
Previously, you couldn’t save a note that contained certain HTML characters, such as a single quote ('), because they can lead to cross-site scripting (XSS) attacks. Salesforce now does the dirty work for you and strips out the unsafe characters and saves the note.

Joined Reports Arrive in Lightning Experience
With up to five blocks, joined reports let you view different types of information in a single report. Each block shows data from one standard or custom report type.
Now that Lightning joined reports are generally available, these actions are supported.


Filter Reports by Inactive Picklist Values
Filtering a report by picklist values is helpful when you want to focus on a specific product family, opportunity stage, or area of the business. Previously, you could filter reports on active picklist values only. Now you can filter by picklist values that are marked inactive as well.

Keep More Related Records When Transferring Accounts in Lightning Experience
When an account rep transfers an account to a different owner, more of the historical information that the new owner needs is also transferred.

Take on Work with the Accept Case Button
Accept one or more cases at a time with the Accept Case button, now in Lightning Experience. Previously, this button was available only in Salesforce Classic on list views for cases that are assigned to a queue. Just like in Salesforce Classic, users in Lightning Experience see the button on the list view but they also see it on the record detail view for a case.

Quickly Focus on Relevant Data with Conditional Formatting (Beta)
Looking for a way to help sales reps easily identify the hottest deals that need immediate attention? Want to know at a glance which accounts have opportunities valued between $100,000 and $500,000? Apply conditional formatting to summary or matrix reports in Lightning Experience to lend color to your reports and gather insights at the same time. 

Subscribe to Reports and Dashboards by Group or Role
Identify report and dashboard subscribers by group or role. That way, your recipient list stays current even when group membership or roles change.

See More Details When You Print Calendars
Printed calendars show outlined time and date blocks, so you can see more event details without the side panel fogging up your view.

Resize Columns to Fit Your Content
You can now adjust report column widths in Lightning Experience report builder and the run page.
Give Us Feedback
Salesforce wants to hear from you! We’re continually innovating based on feedback from our customers. A feedback form now appears in Lightning Experience to hear from more users. You can disable the form.
This change takes effect in March 2019.
The form appears at the bottom of the app. Users can complete or close the form.

Add Two Groups to Lightning Tables
Lightning tables now support two groups. Previously, you could have only one. For example, this dashboard shows opportunities grouped by stage and type.

Clone a Dashboard with Save As
To match reports, the Clone option dashboards is now labeled Save As. The functionality remains the same.

Add Another Date
We renamed the filter option Add More Date to Add Another Date. The previous label snuck past our grammar checkers. The functionality remains the same.

“Whole Number” Relabeled “Full Number”
We’ve changed the Display Units option to display a complete number from “Whole Number” to “Full Number.” Now that you can set decimal precision, “whole number” could be confused for “round to the nearest integer,” which is not what the option does. (To round decimals to the nearest integer, set Decimal Places to “0.”

Reorder Dashboard Filter Values with Drag-and-Drop
You can drag dashboard filter values in the order you want them. Previously, you had to delete the filter values and then add them again in the desired order.

January 18, 2019

GIT Bitucket for Salesforce Version Control

1. Go to https://git-scm.com/downloads.

2. Select the Operating System to download the GIT.


3. Check whether it was installed properly.


4. Configure GIT in your PC.


5. Create a repository in Bitbucket.

6. Create a folder in your computer.

7. Navigate to that folder using command prompt. This folder will be your local repository for master branch(Production).


8. Clone the repository into your local repository.

git clone https://REPOSITORYURL.git

9. Use Force.com IDE or ANT or any other tool and get all the metadata. I have used Eclipse with Force.com IDE.


10. Move the extract to the local repository folder.


11. Run the below commands one by one.

cd existing-project
git init
git add --all
git commit -m "Initial Commit"
git remote add origin https://REPOSITORYURL.git
git push -u origin master

12. Go to Bitbucket and create a branch from existing master branch.


I have created a branch called FullSandbox.

13. In your computer create a folder for this branch. I have created with the name FullSandbox.

14. Download and install TortoiseGit.

15. Navigate to that folder created in step 13.

16. Right Click and select Git Clone.


12. Enter the URL and enter the branch name.


This will be your local repository for FullSandbox branch.

13. Use Force.com IDE or ANT or any other tool and get all the metadata from Full sandbox. I have used Eclipse with Force.com IDE.

14. Move it to the directory.(Replace the files which are already existing since it is from master branch(production)).

15. Right click


16. Click Commit button. This will commit to local repository.

17. Click Push button. This will push it to the remote repository.

18. Do the same steps 13 to 17 for all the branches. Below is for Production. Make sure you have the latest refreshed metadata using Force.com IDE or ANT or any other tool.


January 16, 2019

Multiple Emails separated by coma validation rule in Salesforce

Syntax:

  1. OR(   
  2. NOT(   
  3. REGEX( Emails__c , "([a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z,]{2,4})*")   
  4. ),   
  5. RIGHT( Emails__c , 1 ) = ","   
  6. )  


January 10, 2019

How to create a simple Project and Run in MuleSoft Anypoint studio?

1. Go to File --> New --> Mule Project.


2. Enter a Name and click "Finish" button.


3. Drag and Drop HTTP Listener, Set Payload and Logger from the Mule Palette.

4. Click + button in Connector Configuration in the Listener.


5. Leave as it and click OK button.


6. Enter the path details.


7. Enter Payload value.


8. Run the project. Right click and select Run project sample.


9. Go to http://localhost:8081/sample. Open the downloaded file.




January 8, 2019

Lighting Data Table Sorting while we are using hyper link with Label

Sample Code:

Component:

  1. <aura:component implements="force:appHostable"  
  2.        controller="AccountListController">  
  3.                   
  4.     <aura:attribute type = "Account[]" name = "acctList"/>  
  5.     <aura:attribute name = "mycolumns" type = "List"/>  
  6.     <aura:attribute name = "sortedBy" type = "String" default = "Name"/>  
  7.     <aura:attribute name = "sortedDirection" type = "String" default = "asc"/>  
  8.       
  9.     <aura:handler name = "init" value ="{! this }" action = "{! c.fetchAccounts }"/>  
  10.       
  11.     <lightning:datatable data = "{! v.acctList }"   
  12.                          columns = "{! v.mycolumns }"   
  13.                          keyField = "id"  
  14.                          hideCheckboxColumn = "true"  
  15.                          onsort = "{! c.updateColumnSorting }"  
  16.                          sortedBy = "{! v.sortedBy }"    
  17.                          sortedDirection = "{! v.sortedDirection }"/>  
  18.       
  19. </aura:component>  

Component Controller:

  1. ({  
  2.       
  3.     fetchAccounts : function( component, event, helper ) {  
  4.           
  5.         component.set( 'v.mycolumns', [  
  6.             {label: 'Account Name', fieldName: 'linkName', type: 'url', sortable: true,   
  7.             typeAttributes: {label: { fieldName: 'Name' }, target: '_blank'}},  
  8.             {label: 'Industry', fieldName: 'Industry', type: 'text', sortable: true},  
  9.             {label: 'Type', fieldName: 'Type', type: 'Text'}  
  10.         ] );  
  11.         var action = component.get( "c.fetchAccts" );  
  12.         action.setParams({  
  13.         });  
  14.         action.setCallback(this, function( response ){  
  15.             var state = response.getState();  
  16.             if ( state === "SUCCESS" ) {  
  17.                 var records =response.getReturnValue();  
  18.                 records.forEach( function( record ){  
  19.                     record.linkName = '/' + record.Id;  
  20.                 });  
  21.                 component.set( "v.acctList", records );  
  22.                 helper.sortData( component, component.get( "v.sortedBy" ), component.set( "v.sortedDirection" ) );  
  23.             }  
  24.         });  
  25.         $A.enqueueAction(action);  
  26.           
  27.     },  
  28.       
  29.     updateColumnSorting: function (cmp, event, helper) {  
  30.           
  31.         var fieldName = event.getParam( 'fieldName' );  
  32.         cmp.set( "v.sortedBy", fieldName );  
  33.         if ( fieldName === 'linkName' )  
  34.             fieldName = 'Name';  
  35.         var sortDirection = event.getParam( 'sortDirection' );  
  36.         cmp.set( "v.sortedDirection", sortDirection );  
  37.         helper.sortData( cmp, fieldName, sortDirection );  
  38.           
  39.     }  
  40.   
  41. })  

Component Helper:

  1. ({  
  2.       
  3.     sortData: function ( cmp, fieldName, sortDirection ) {  
  4.           
  5.         var data = cmp.get( "v.acctList" );  
  6.         var reverse = sortDirection !== 'asc';  
  7.         data.sort( this.sortBy( fieldName, reverse ) )  
  8.         cmp.set( "v.acctList", data );  
  9.           
  10.     },  
  11.       
  12.     sortBy: function ( field, reverse, primer ) {  
  13.           
  14.         var key = primer ?  
  15.             function( x ) { return primer( x[ field ] ) } :  
  16.             function( x ) { return x[ field ] };  
  17.         reverse = !reverse ? 1 : -1;  
  18.         return function ( a, b ) {  
  19.               
  20.             return a = key( a ), b = key( b ), reverse * ( ( a > b ) - ( b > a ) );  
  21.               
  22.         }  
  23.           
  24.     }  
  25.       
  26. })  

Apex Class:

  1. public class AccountListController {    
  2.         
  3.     @AuraEnabled    
  4.     public static List < Account > fetchAccts() {    
  5.             
  6.         return [ SELECT Id, Name, Industry, Type, CreatedDate  
  7.                    FROM Account   
  8.                   LIMIT 100 ];    
  9.             
  10.     }      
  11.         
  12. }  

Output: