Wednesday, 14 September 2022

Basic Integration interview Questions

 What is integration? Why we need integration in Salesforce?

Integration is a process of connecting two applications. Enterprise system uses many applications, many or most of which are not designed to work with one another out of the box. Each application can have data, business logic, presentation, and security layers, all of which are possible targets for integration.

 Integration comes in picture when some interaction is required from external system. Let us take example, we want to validate address of account record. This can be done using google address validation or smarty street API integration.

What Is Webservices?

Webservices is a functionality or code which helps to us to do integration. Web services are open standard (XML, SOAP, HTTP, etc.) based web applications that interact with other web applications for the purpose of exchanging data.

There are two types of Webservices:

·       SOAP web services.

·       RESTful web services.

What is REST API?

A REST API is also known as RESTful API. It stands for representational state transfer. REST API has a lightweight request and response framework. It is a simple, easy-to-use, and powerful web service based on RESTful principles. REST API supports both XML and JSON. The protocol for REST is HTTP.

 @RestResource(urlMapping='/your URL/*')

 Methods used in REST:

@HTTPDELETE : The @HttpDelete annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP DELETE request is sent, and deletes the specified resource.  

To use this annotation, your Apex method must be defined as global static.

 @HTTPGET : The @HttpGet annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP GET request is sent, and returns the specified resource. These are some considerations when using this annotation:

·        To use this annotation, your Apex method must be defined as global static.

·        Methods annotated with @HttpGet are also called if the HTTP request uses the HEAD request method.

 @HTTPPATCH : The @HttpPatch annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP PATCH request is sent, and updates the specified resource.

To use this annotation, your Apex method must be defined as global static.

 @HTTPPOST : The @HttpPost annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP POST request is sent, and creates a new resource.

To use this annotation, your Apex method must be defined as global static.

 @HTTPPUT : The @HttpPut annotation is used at the method level and enables you to expose an Apex method as a REST resource. This method is called when an HTTP PUT request is sent, and creates or updates the specified resource.

To use this annotation, your Apex method must be defined as global static.

  What is Remote Site Settings?

Before any apex callout can call an external site, that site must be registered in the remote site settings page or the callout fails. Salesforce prevents callout to unauthorized network access.

  What is Named Credentials?

Using Named credentials, We can make callout to external system without supplying username and password. A Named credentials specifies the URL of a callout endpoint and its required authentication parameters in one definition.

  What is SOAP API?

SOAP is the Simple Object Access Protocol which supports XML only. you can create, get, delete, and update records using the SOAP API (Simple Object Access Protocol API). Any language that supports web services can utilize the SOAP API. Here are the features of SOAP API.

·        Relies on XML and Schema.

·        Strongly types messaging framework.

·        Operations and its XML structure of request and response defined.

·        Communicated through WSDL.

·        The underlying transport protocol can be sent over almost any protocol, server-side such as HTTP, SMTP, TCP, or JMS.

  Difference Between REST and SOAP.

 

REST

SOAP

 

REST is not a protocol; it is an architectural style.

SOAP is a protocol.

REST uses URL to expose the web service.

SOAP uses WSDL class to expose the web service

REST allows different data formats: XML, JSON, plain text.

SOAP Allows Only XML format

REST requires less bandwidth than SOAP.

SOAP requires more bandwidth than REST.

RESTful services inherit security measure from underlying transport layer

SOAP uses its own security measures. SOAP is based on standardized Web service security. Thus, better secured compared to REST. SOAP is more reliable in terms of security than REST

 What is Connected App?

A connected app is a framework that enables an external application to integrate with Salesforce using APIs and standard protocols, such as SAML, OAuth, and OpenID Connect. Connected apps use these protocols to authenticate, authorize, and provide single sign-on (SSO) for external apps.

 What is OAuth?

OAuth is short for open authorization. OAuth 2.0 is a framework that allows for a secure way for systems to establish trust with one another. The end goal is to obtain an access token that can be used by to access protected resources without ever providing your username or password to the other system.

How Many Callouts To External Service Can Be Made In A Single Apex Transaction?

Governor limits will restrict a single Apex transaction to make a maximum of 100 callouts to an HTTP request or an API call.

What Is Call In And Call Out?

Call In is used to exposing our webservices to another users Call Out is used to invoking or consuming our webservices to others.

What is JSON ?

JSON stands for JavaScript Object Notation. JSON is light weighted than XML.  When exchanging data between a browser and a server, the data can only be text. JSON is text, and we can convert any JavaScript object into JSON, and send JSON to the server.

 

 

Friday, 2 September 2022

Salesforce lightning flow

                            LIGHTNING FLOW

What is Flow?

The Salesforce Flows are an automated application that captures and records all data and takes necessary actions accordingly. It’s an automated application that collects data and performs the required steps in the system.

What is Flow Builder?

Flow Builder is a declarative way to automate complex business processes. For example, flow builders can automate processes that need creating/updating unrelated records, querying multiple objects, or running loops on the data. Flow builders can also access external systems. Flows can be further extended by adding Apex actions.

What are different types of flows?

1.      Screen Flow: It can be called using a button or an action or displayed in a Lightning Page or the Utility Bar. It appears as a screen for the user to interact with. Screen flow cannot be automatically triggered.

 

2.     Record Triggered Flow: It begins when a record is created or updated.

3.     Auto launch Flow: These can be called by Apex, Process Builder, or another Flow.

4.     Scheduled Triggered Flow: It runs automatically on a recurring schedule. It is helpful for jobs performed frequently or on a schedule (once, daily, weekly).

5.     Platform event-triggered Flows: These are called when a platform event is received

 

What are elements in Flow?

Elements tab displays Interaction, logic, and data elements available for the flow. Each element is an action the flow can execute. New elements can be created from the Elements Tab.

Interaction Elements

1.     Screen: Screen element / User interface for the flow. The screen can be used to display information or can be used to collect data from the user. This element is available only in Screen Flows.

2.     Actions: Actions are external actions that further extend the functionality of the flow. Some examples for actions – Apex, Send emails, etc.

3.     Subflow: A flow can initiate another flow.

Logic Elements

1.     Decisions: Decision split the flow depending on the data that’s being sent through the decision element.

2.     Assignments: Assignments give a value to a variable.

3.     Loops: Loops handle multiple variables at once using collections.

Data elements

Data elements allow the flows to fetch, create, update or delete records in the database. The elements include Get Record, Create Record, Update Record, and Delete Record. Get Record is used to fetch record/s from the database. Create Record, Update Record, and Delete Record are used to activate the data in the database.

What is difference between flow and process builder?

  • Flows can be designed to trigger upon creation, update, or deletion of a record. Processes can trigger only for creation or updates to a record.
  • Flows allow you to add screens where users can enter data. Processes do not have this capability.
  • Flows can be paused by users, but processes run when the criteria is met and cannot be paused.
  • Process actions are executed in the order in which they appear in the process definition, but flows can have different and more complex orders of operations.
  • Flows can be designed to run either before or after a record has been saved to the database, but processes can only trigger after a record has been saved.
  • Flows can be built to cycle through multiple unrelated and related objects. Processes, however, are limited to the base object (opportunities, for example) and related objects (accounts).

·        The following actions are only available for processes: QUIP Actions, send survey invitation.

How to handle fault in Salesforce flow?

If any element is connected to second screen, it automatically becomes fault screen and we can use “$Flow.FaultMessage” on screen to show error message. output text can be added on screen with message something like “Sorry, an error occurred in the page. 

What is Flow interview in Salesforce?

A flow interview is a running instance of a flow. A flow is an application built by your administrator that asks you for inputs and does something in Salesforce based on those inputs.

 

 

 

Duplicate id in list

  Error 'System.ListException: Duplicate id in list' in Apex : list  can hold  duplicate values, but if you try to add duplicate  sO...