October 30, 2019

Salesforce Interview Questions with Answers Part 58

1. Unconvert Leads in Salesforce
Once the Lead is converted, we cannot unconvert it in Salesforce.

Using View and Edit Converted Leads permission in the Profile, users can edit the Leads. But, users can’t unconvert leads. Even with this permission if the user updates the Lead to a different status, ConvertedAccountId and ConvertedOpportunityId fields cannot be updated through a trigger. These are system fields.

It is better to delete the opportunity and create a new Leads.

http://www.infallibletechie.com/2018/10/profile-permission-to-view-and-edit.html

Vote for the below Idea
https://success.salesforce.com/ideaView?id=08730000000ksj0AAA

2. Id token Vs access token
ID Token
You will get id token if you are using the scope as OpenID. Id token is specific to the OpenID scope. With OpenID scope you can get both id token and access token.

Access Tokens
Access tokens are used as bearer tokens. A bearer token means that the bearer (who holds the access token) can access authorized resources without further identification. Because of this, it’s important that bearer tokens are protected. If I can somehow get ahold of and “bear” your access token, I can pretend as you.
These tokens usually have a short lifespan (dictated by its expiration) for improved security. That is, when the access token expires, the user must authenticate again to get a new access token limiting the exposure of the fact that it’s a bearer token.

3. What is the difference between JWT & JWT Token Exchange in Salesforce Named Credentials?
JWT Token: 
Salesforce will issue the token for the external system. When your code uses the named credential to call your third party service, Salesforce will send the newly issued JWT token to your third party service as a bearer token.

JWT Token Exchange: 
Salesforce will issue a JWT token and send it to the external authorization service( Token Endpoint URL). The authorization service will exchange the provided JWT token for the access token. When your code uses the named credential to call your third party service, Salesforce will send the access token received from authorization service to your third party service as a bearer token to authenticate into the external system.

4. JWT Token
JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed. JWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA.

Although JWTs can be encrypted to also provide secrecy between parties, we will focus on signed tokens. Signed tokens can verify the integrity of the claims contained within it, while encrypted tokens hide those claims from other parties. When tokens are signed using public/private key pairs, the signature also certifies that only the party holding the private key is the one that signed it.

JSON Web Token structure
In its compact form, JSON Web Tokens consist of three parts separated by dots (.), which are:

Header
Payload
Signature
Therefore, a JWT typically looks like the following.

xxxxx.yyyyy.zzzzz

5. Difference between OAuth 2.0 and Service Account for authentication in Salesforce Outlook Integration
OAuth 2.0
1. For Exchange Online with Office 365.
2. It doesn't support On-Premises Exchange.
Service account
1. For On-Premises Exchange 2016, 2013, and Exchange Online with Office 365

6. OpportunityHistory and OpportunityFieldHistory
OpportunityHistory object represents the history of a change to the Amount, Probability, Stage, or Close Date fields of an Opportunity. The OpportunityFieldHistory object represents the history of a change to any of the fields of an Opportunity.

7. Federate Id Vs Delegate Id
Federated ID: Federated solution means that you establish a trust/agreement with few third party identity service providers and use them for authentication. Users can any of those services. It makes no difference to you which (from the allowed ones) account/service is being used for authentication. It is one of the ways to implement SSO. Usually based on SAML and OpenID.

Delegated ID: Delegated ID solution is to outsource your authentication part to one fixed site. Only that website will be trusted for login to your site/app.

8. Asset sharing Controlled By Parent
If asset sharing is set to the Controlled by Parent—the default setting—the Account field, Contact field, or both must be completed for an asset to be saved. If asset sharing is not set to Controlled by Parent, assets can be saved without an associated account or contact.

9. Zones in Salesforce Idea
Zones organize ideas and questions into logical groups, with each zone having its own focus and unique ideas and questions. Zones are shared by the Ideas, Answers, and Chatter Answers applications, allowing you to view and create zones from those locations. Professional Edition organizations can have only one internal zone. All other editions can have up to 50 zones shared between Ideas, Answers, and Chatter Answers.

10. DKIM
Salesforce DKIM KeysSalesforce uses DKIM keys to sign outbound emails that your organization sends from the Salesforce platform.
Use the DKIM (DomainKeys Identified Mail) key feature to let Salesforce sign outbound email sent on your company’s behalf. These signatures give recipients confidence that the email was handled in a way that’s consistent with your company.
To ensure your email message from Salesforce does not end up unread in the recipient’s spam folder, you can easily implement DomainKeys Identified Mail (DKIM). Use the DKIM (DomainKeys Identified Mail) key feature to enable Salesforce to sign outbound emails sent on your organization’s behalf. A valid signature provides recipients confidence that the email was handled by a third party such as Salesforce in a way authorized by your organization.
Make sure you add the public key to your DNS record before you make your key active in Salesforce and start DKIM signing. DKIM signing is active whenever your DKIM key is in the active state.
Note: DKIM avoid sending emails to Spam.

11. Datorama
The Datorama marketing intelligence and analytics platform eliminates the time-intensive, manual process of combining disparate data sources to gain a comprehensive understanding of marketing campaigns. With Datorama, you get back valuable time and bandwidth to analyze data, optimize performance within campaigns, discover insights in real-time, and then take action on them. That’s how Datorama drives transparency, speed, and growth.

12. What is the use of Maintenance Plans in Field Service Lightning
Maintenance Plans are used to schedule and create Work Orders for the future.

Create preventive maintenance plans for specific assets so your customers never miss a beat. Maintenance plans let you define how often maintenance visits occur and mass-generate work orders for future visits.

13. Experienced Page Time (EPT) in Salesforce
Salesforce defines EPT as the time when a page starts loading to the time when no activity has occurred for at least two frames (about 33 milliseconds). We need two extra frames to catch asynchronous activities, such as data transfer or user interaction.
Enable Lightning Component Debug Mode from Setup. When this setting is enabled, it adds a counter to the Lightning Experience header that shows page load time and network bandwidth. One thing to keep in mind when enabling this setting is that performance may be impacted because the component code will be minified and caching is disabled.

14. Database.RaisesPlatformEvents
Batch Apex classes can fire platform events when encountering an error or exception. Event records provide more granular tracking of errors than the Apex Jobs UI because they include the record IDs being processed, exception type, exception message, and stack trace. You can also incorporate custom handling and retry logic for failures. Clients listening on an event can tell how often it failed, which records were in scope at the time of failure, and other exception details. Events are also fired for Salesforce Platform internal errors and other “uncatchable” Apex exceptions like LimitExceptions that are caused by reaching governor limits.

The BatchApexErrorEvent object represents a platform event associated with a batch Apex class.
This object is available in API version 44.0 and later.
If the start, execute, or finish method of a batch Apex job encounters an unhandled exception, a BatchApexErrorEvent platform event is fired.

To fire a platform event, a batch Apex class declaration must implement the Database.RaisesPlatformEvents interface.

15. Delegated Approver
Delegated Approver is an alternate approver.

This user receives the same approval requests as you do.

Delegated approvers can't reassign approval requests. But, they can approve or reject approval requests.

Having the "Record Editability" setting set to "Administrator OR Current Approver" does not apply to the delegated approver.

https://success.salesforce.com/ideaview?id=08730000000BrJYAA0

16. What is the use of @track?
By using @track, we take advantage of a relatively new JavaScript feature called a decorator. This decorator attaches functionality to the property that ensures that when its value changes, the component’s DOM is rerendered.

17. Difference between Federated authentication and Delegated authentication in Salesforce
Federated authentication uses SAML, an industry-standard for secure integrations.
Federated authentication using Security Assertion Markup Language (SAML) lets you send authentication and authorization data between affiliated but unrelated web services. You can log in to Salesforce from a client app. Salesforce enables federated authentication for your org automatically.

Use delegated authentication if you have mobile users in your organization, or if you want to enable single-sign-on for partner portals or Customer Portals. You must request that this feature be enabled by salesforce.com.
You can manage delegated authentication at the permission level, not at the org level, giving you more flexibility. With permissions, you can require some users to use delegated authentication and others to use their Salesforce-managed password.
Delegated authentication still sends the username and password (possibly even your network password) over the internet to Force.com.

1. When a user tries to log in—either online or using the API—Salesforce validates the username and checks the user’s permissions and access settings.
2. If the user has the Is Single Sign-On Enabled user permission, Salesforce doesn’t validate the username and password. Instead, a web service call is made to the user’s org to validate the username and password. When this user permission is enabled, Salesforce no longer manages the policies for user passwords, such as when passwords expire or the required minimum length. Instead, the delegated authentication endpoint’s service enforces password policies.
Note
Salesforce doesn’t store, log, or view the password. It’s disposed of immediately after the process completes.
3. The web service call passes the username, password, and source IP to your web service. The source IP is the address where the login request originated. You must create and deploy an implementation of the web service that Salesforce servers can access.
4. Your web service implementation validates the passed information and returns either true or false.
5. When the response is true, the login process continues, a new session is generated, and the user proceeds to the app. When false, the user gets an error message that the username and password combination is invalid.
Note
With delegated authentication, a user can experience a slight delay when logging in while the user account becomes available in the org.

18. Factory Function
Since functions are first-class objects, another way to declare a function is when a function returns another function. This pattern is often referred to as a factory function.

// when invoked, this function will assign a function
function gearFactory(){
  return function(driverGear, drivenGear){
    return (driverGear / drivenGear);
  }
}
// calculateGearRatio can now be invoked as a function
const calculateGearRatio = gearFactory();
// and all the rest

While the above example is simplistic, it’s valid. Factory functions are useful for one-off reusable functions, especially to capture variable references in a closure.

19. Can we define a method inside an object in JavaScript?
Yes. Object literals are a great way to create ad hoc data structures to pass data between functional parts of a JavaScript program, but you should avoid defining a function in an object literal.
Example:
const bike = {
  gears: 10,
  currentGear: 3,
  changeGear: function(direction, changeBy) {
    if (direction === 'up') {
      this.currentGear += changeBy;
    } else {
      this.currentGear -= changeBy;
    }
  }
}
console.log(bike.gears); // 10
console.log(bike.currentGear); //3
bike.changeGear('up', 1);
console.log(bike.currentGear); //4

20. Email Opt Out in Salesforce
The Email Opt Out field will allow you to exclude marked contacts from mass e-mail.
Email Opt Out field shows a message/warning when the user tries to send an email.

This field doesn't block to send an email. Check-in apex, workflow rule, and process builder before sending email alerts. 

21. Define the primitive data type

A primitive value is a value that has no properties or methods.
A primitive data type is data that has a primitive value.

22. Closures and Copy
Closures:
When a function is declared, it holds a reference to any variables or arguments declared within it, and any variables it references in the scope that it is contained within. This combination of its variables and arguments along with local variables and arguments from its containing scope is called a closure.

Consider this function, and the function it returns.

const greetingMaker = function(greeting){
  return function(whoGreeting){
    return greeting + ", " + whoGreeting + "!";
  }
}
const greetingHello = greetingMaker("Hello");
const greetingBonjour = greetingMaker("Bonjour");
const greetingCiao = greetingMaker("Ciao");
console.log(greetingHello("Gemma")); // Hello, Gemma!
console.log(greetingBonjour("Fabien")); // Bonjour, Fabien!
console.log(greetingCiao("Emanuela")); // Ciao, Emanuela!

Copy:
When greetingMaker is invoked, we might normally imagine its greeting argument to last only for the life of it being called.

But the returned function keeps a reference to the greeting argument in greetingMaker’s scope. So that finally when it is invoked through greetingHello/Bonjour/Ciao, it’s still accessible.

23. Using the prototype Property
The JavaScript prototype property allows you to add new properties to object constructors:

Example
function Person(first, last, age, eyecolor) {
  this.firstName = first;
  this.lastName = last;
  this.age = age;
  this.eyeColor = eyecolor;
}

Person.prototype.nationality = "English";

The JavaScript prototype property also allows you to add new methods to objects constructors:

Example
function Person(first, last, age, eyecolor) {
  this.firstName = first;
  this.lastName = last;
  this.age = age;
  this.eyeColor = eyecolor;
}

Person.prototype.name = function() {
  return this.firstName + " " + this.lastName;
};

24. Difference between var and let in JavaScript
var and let are both used for function declaration in javascript but the difference between them is that var is function scoped and let is block scoped.
It can be said that a variable declared with var is defined throughout the program as compared to let.
An example will clarify the difference even better
Example of var:

Input:
console.log(x);
var x=5;
console.log(x);
Output:
undefined
5

Example of let:

Input:
console.log(x);
let x=5;
console.log(x);
Output:
Error

25. What Is the Difference Between the Salesforce Events?
Platform Events
Platform events enable you to deliver secure, scalable, and customizable event notifications within Salesforce or from external sources. Platform event fields are defined in Salesforce and determine the data that you send and receive. Apps can publish and subscribe to platform events on the Force.com Platform using Apex or in external systems using CometD.

Streaming API Events
Streaming API provides two types of events that you can publish and subscribe to: PushTopic and generic. PushTopic events track field changes in Salesforce records and are tied to Salesforce records. Generic events contain arbitrary payloads. Both event types don’t provide the level of granular customization that platform events offer. You can send a custom payload with a generic event, but you can’t define the data as fields. You can’t define those types of events in Salesforce, and you can’t use them in Apex triggers.

26. Publish Behavior in Salesforce Platform Event
Indicates when a platform event message is published in a Lightning Platform transaction.

Choose:
Publish After Commit to have the event message published only after a transaction commits successfully. With this option, a subscriber receives the event message after the data is committed. If the transaction fails, the event message isn't published.
Publish Immediately to have the event message published when the publish call executes, regardless of whether the transaction succeeds. With this option, a subscriber might receive the event message before the data is committed.

27. API Calls for Data Replication
The API supports data replication with the following API calls:
getUpdated() Retrieves the list of objects that have been updated (added or changed) during the specified timespan for the specified object.
getDeleted() Retrieves the list of objects that have been deleted during the specified timespan for the specified object.

Polling no more frequently than every five minutes. There are built-in controls to prevent errant applications from invoking the data replication API calls too frequently.

Salesforce limits the number of queries that a user can execute concurrently. A user can have up to 10 query cursors open at a time. If 10 QueryLocator cursors are open when a client application, logged in as the same user, attempts to open a new one, then the oldest of the 10 cursors is released. If the client application attempts to open the released query cursor, an error results.

28. Opportunity Closed Date must be in current month Salesforce Validation Rule
https://www.infallibletechie.com/2019/10/opportunity-closed-date-must-be-in.html

29. Whenever Case record is created task should be created to system admin
Create a Workflow Rule and define Workflow action as Task. Set the admin in the Assigned To field.

30. Whenever Lead is converted into opportunity, the stage value should be prospecting(field update)
On lead conversion Opportunity stage by default is the one on top of the picklist "Stage" in Opportunity. To change the default value, move the desired default value on top of the list.

https://help.salesforce.com/articleView?id=000321509&language=en_US&type=1&mode=1

No comments:

Post a Comment