1. How to find whether apex is currently executed in Trigger Context in Salesforce?
Trigger.isExecuting can be used to find whether apex is currently executed in Trigger Context in Salesforce.
Sample Code:
System.debug( 'Is it in trigger context ' + Trigger.isExecuting );
2. How to assign multiple Permission Sets using System for Cross-Domain Identity Management (SCIM) REST API in Salesforce?
3. force:recordData loads the record synchronously or asynchronously in Salesforce Lightning Aura Component?
force:recordData loads the record asynchronously by pulling the data from the Salesforce Server. So, recordUpdated should be used to monitor when the record is Loaded, Changed(Updated), Removed(Delete) and errored out.
Component:
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="record" type="Object" description="The record object" />
<aura:attribute name="recordError" type="String" description="An error message bound to force:recordData" />
<lightning:card>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
fields="Subject, Description"
targetFields="{!v.record}"
targetError="{!v.recordError}"
recordUpdated="{!c.handleRecordUpdated}"
mode="VIEW"/>
Case Id: {!v.recordId}<br/>
Case Subject: {!v.record.Subject}
</lightning:card>
</aura:component>
JavaScript:
({
handleRecordUpdated : function(component, event, helper) {
var eventParams = event.getParams();
if(eventParams.changeType === "LOADED") {
console.log( 'Record Loaded' );
var flow = component.find("flowData");
} else if(eventParams.changeType === "CHANGED") {
console.log( 'Record Changed' );
} else if(eventParams.changeType === "REMOVED") {
console.log( 'Record Removed' );
} else if(eventParams.changeType === "ERROR") {
console.log("Error Change Type");
}
}
})
4. Sender Policy Framework Sender Policy Framework (SPF)
Sender Policy Framework Sender Policy Framework (SPF) is a simple email validation system designed to detect email spoofing. SPF provides a process to verify which providers can send emails on your behalf. It also aims to reduce spam and fraud by making it harder for anyone to hide their identity.Email spoofing is a technique used in spam and phishing attacks to trick users into thinking a message came from a person or entity they either know or can trust.
5. How to resume the Platform Event trigger from the failed replayId?
EventBus.TriggerContext.currentContext().setResumeCheckpoint(replayId) can be used to resume the Platform Event trigger from the failed replayId.
6. How to use Trigger.operationType in Salesforce Trigger?
Switch statement should be utilized to use Trigger.operationType in Salesforce Trigger.
Sample Code:
trigger AccountTrigger on Account( before insert, after insert, before update, after update ) {
switch on Trigger.operationType {
when BEFORE_INSERT {
System.debug( 'Before Insert' );
}
when AFTER_INSERT {
System.debug( 'After Insert' );
}
when BEFORE_UPDATE {
System.debug( 'Before Update' );
}
when AFTER_UPDATE {
System.debug( 'After Update' );
}
}
}
7. Scoping Rules in Salesforce
Scoping Rule in Salesforce filters the data that the users have access via OWD and other sharing mechanisms like Role Hierarchy, Manual Sharing, etc.
In List View and Report Filters, Filter By Scope can be used to focus on the Scoped Data.
8. How query CombinedAttachment in Salesforce?
We cannot query CombinedAttachment object/entity as Query() is not supported. So, we can use Sub-Query to fetch CombinedAttachment records.
Sample Code:
Case objCase = [
SELECT Id,
( SELECT Id FROM CombinedAttachments )
FROM Case
WHERE Id = '<CaseRecordId>'
];
System.debug(
'CombinedAttachments Count is ' + objCase.CombinedAttachments.size()
);
To know more, check the following blog post:
9. Difference between Deployment and Release?
Deployment:
Moving metadata to an environment.
Release:
Moving metadata to a live environment(Production). Every release is a deployment. But, it is moved to production.
10. CORS
CORS is a feature that block web pages making requests to different domains apart from the served domain. It avoids unauthorised requests. CORS does checks for the headers in the HTTP Requests and responses. If the domain1 wants to allow requests from domain2, it will set Access-Control-Allow-Origin Header in its responses to domain 2. So, the browser will allow the web page from domain2 to make requests to the domain1.
11. Muting Permissions in Salesforce Permission Set Group.
Muting lets you customize a permission set group by muting (disabling) selected permissions in it. To mute a permission, you add the permission to a muting permission set in the selected permission set group. When you mute a permission in a permission set group, the muting affects only users assigned to the permission set group, not users assigned directly to a permission set outside of the permission set group. So, muting offers you great flexibility when you design your permissions model.
12. How to set Expiration Date to Permission Sets or Permission Set Groups?
Enable “Permission Set & Permission Set Group Assignments with Expiration Dates” under User Management Settings in Setup. When assigning Permission Set or Permission Set Group, set the Expiration Date.
13. How to create Mobile App using Salesforce Platform?
mySalesforce can be used to create Mobile App using Salesforce Platform.
14. Single Page App
Web apps that load a sing page and dynamically update that page as the user interacts.
1. No Page Reloads
2. Client Side centric
3. Responsive UX
15. How to pass data from Salesforce to Canvas App?
parameters attribute in apex:canvasApp tag can be used to pass data from Salesforce to the Canvas App.