You need to escape the below
1. & – ampersand
2. < – less than symbol( < )
3. > – greater than symbol( > )
4. " – quote
5. ' – apostrophe
2. Composite Request in Salesforce
1. Executes a series of REST API requests in a single call.
2. The response bodies and HTTP statuses of the requests are returned in a single response body.
3. The entire request counts as a single call toward your API limits.
The request body contains an allOrNone flag that specifies how to roll back errors. If true, entire request is rolled back. If false, the remaining sub-requests that don’t depend on the failed sub-requests are executed. In either case, the top-level request returns HTTP 200 and includes responses for each sub-request.
collateSubrequests
Controls whether the API collates unrelated subrequests to bulkify them (true) or not (false).
When subrequests are collated, the processing speed is faster, but the order of execution is not guaranteed (unless there is an explicit dependency between the subrequests).
If collation is disabled, then the subrequests are executed in the order in which they are received. Use this field if you have dependencies between your subrequests and you need to control the order of execution. If you don’t have an explicit dependency between your subrequests, then set collateSubrequests to true.
Check this for more information – https://www.infallibletechie.com/2020/04/composite-request-in-salesforce.html
3. Difference between Application Event and Component Event
The major difference between application and component event is that component event is used in child to parent components and application event can be used through out the application
Component Event:
A change in a child component can be communicated to the parent component via component event.
Application Event:
Components which have registered for this event will get notified.
Reference Link – https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_intro.htm
Note:
Always try to use a component event instead of an application event, if possible. Component events can only be handled by components above them in the containment hierarchy so their usage is more localized to the components that need to know about them. Application events are best used for something that should be handled at the application level, such as navigating to a specific record. Application events allow communication between components that are in separate parts of the application and have no direct containment relationship.
4. Different between Composite and Batch in Composite Resources
Composite
In a subrequest’s body, you specify a reference ID that maps to the subrequest’s response. You can then refer to the ID in the url or body fields of later subrequests by using a JavaScript-like reference notation.
allOrNone flag is available for roll back option.
Batch
Subrequests are independent, and you can’t pass information between them. Subrequests execute serially in their order in the request body.
If a batch request doesn’t complete within 10 minutes, the batch times out and the remaining subrequests aren’t executed.
5. Automated Process User in Salesforce
1. Platform event triggers/flows/process.
2. Approval Process Knowledge Actions.
You
can use getSessionId() both synchronously and asynchronously. In
asynchronous Apex (Batch, Future, Queueable, or Scheduled Apex), this
method returns the session ID only when the code is run by an active,
valid user. When the code is run by an internal user, such as the
automated process user or a proxy user, the method returns null.
As a best practice, ensure that your code handles both cases(Internal/External Users and Automated Process User).
With the introduction of API version 41.0, “Automated Process User” was made available.
Sample Class:
public class Sample {
public static void fetchAutomatedUser() {
System.debug( [ SELECT Id, Name, Alias FROM User WHERE Name = ‘Automated Process’ ] );
}
}
Code to Execute for testing:
Sample.fetchAutomatedUser();
If the API version of the Apex Class is 41 and above, the SOQL returns values.
If the API version of the Apex Class is 40 and below, the SOQL doesn’t return any value.
Profile Name with UserInfo.getProfileId() is null:
Starting
api version 41.0 there are 2 internal users which are exposed in test
class context. These users does not have normal profiles which is
resulting in the error.
https://help.salesforce.com/articleView?id=000319488&type=1&mode=1
6. How to get URL Parameters in Visualforce Page?
Syntax:
{!$CurrentPage.parameters.Paramtervalue}
Help Article – https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_currentpage.htm
Sample Code:
<apex:page >
{!$CurrentPage.parameters.recId}<br/>
{!$CurrentPage.parameters.checkBool}
</apex:page>
7. How to do Callouts from Queueable Interface?
8. Composite Graph in Salesforce
9. How to abort Apex Jobs using Apex in Salesforce?
10. Chat Button Type in Salesforce
11. Binary and Numeric Prediction Salesforce
Binary predictions refer to yes/no predictions. Output will be a score and not a boolean. Score provides the likelyhood.
Example: Lead Scoring, Opportunity Scoring.
A binary outcome is an outcome variable that has only two text values, such as win-lose, pass-fail, or retain-churn. A story that represents a classification use case has a binary outcome variable.
Numeric predictions refer to predicting a number.
Example: Sales revenue prediction.
12. Securing Lightning Web Components
13. @api Read only in LWC
When a component decorates a field with @api to expose it as a public property, it should set the value only when it initializes the field. After the field is initialized, only the owner component should set the value. A component should treat values passed to it as read-only. To trigger a mutation for a property value provided by an owner component, a child component can send an event to the parent. If the parent owns the data, the parent can change the property value, which propagates down to the child component via the one-way data binding.
https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_components_data_flow
14. Wire Service in LWC
In the wire adapter’s configuration object, prefix a value with $ to reference a property of the component instance. The $ prefix tells the wire service to treat it as a property of the class and evaluate it as this.propertyName. The property is reactive. If the property’s value changes, new data is provisioned and the component rerenders.
We call the wire service reactive in part because it supports reactive variables, which are prefixed with $. If a reactive variable changes, the wire service provisions new data. We say “provisions” instead of “requests” or “fetches” because if the data exists in the client cache, a network request may not be involved.
Decorate a Property with @wire
Wiring a property is useful when you want to consume the data or error as-is.
If the property decorated with @wire is used as an attribute in the template and its value changes, the wire service provisions the data and triggers the component to rerender. The property is private, but reactive.
The property is assigned a default value after component construction and before any other lifecycle event. The default value is an object with data and error properties of undefined. Therefore, you can access the property’s value in any function, including functions used by the template or used as part of the component’s lifecycle.
Decorate a Function with @wire
Wiring a function is useful to perform logic whenever new data is provided or when an error occurs. The wire service provisions the function an object with error and data properties, just like a wired property.
The function is invoked whenever a value is available, which can be before or after the component is connected or rendered.
15. Adding Contacts to Case Team Member in Salesforce