Problem:
Solution: Go to your logged in user details and make sure knowledge user checkbox is enabled
Output:
A blog containing Salesforce coding examples in detail.It's a place where you can find solutions to the problems that you may face in your daily salesforce coding. Apex classes,visual force page,we services,Integration,plugins,extensions,Lightning web components,Aura components,Email Messages,Sales cloud,service Cloud,Marketing Cloud.Lightning Web components,salesforce.com, Salesforce Tips and Tricks,short cuts,ApexMocks,Stubs, visibility,Salesforce Shorts
Problem:
Solution: Go to your logged in user details and make sure knowledge user checkbox is enabled
Output:
List<System.OrgLimit> lstOrgLimits = OrgLimits.getAll();
for (System.OrgLimit objLimit : lstOrgLimits) {
System.debug('Limit : ' + objLimit.getName());
System.debug('Current Limit: ' + objLimit.getValue());
System.debug('Max Limit : ' + objLimit.getLimit());
}
Output:
To get specific limit, for example file storage limit use the below code
System.OrgLimit objLimit = OrgLimits.getMap().get('FileStorageMB');
System.debug('Limit : ' + objLimit.getName());
System.debug('Current Limit: ' + objLimit.getValue());
System.debug('Max Limit : ' + objLimit.getLimit());
Output:
Below are the salesforce YouTube channels that I follow . Hope you do follow them and gain some knowledge.
1) Salesforce Developers https://www.youtube.com/@SalesforceDevs/videos
2) Salesforce Architects https://www.youtube.com/@SalesforceArchitects/videos
3) Apex Hours https://www.youtube.com/@apexhours
4) Samarth Ahuja Tech Videos https://www.youtube.com/@samCoder
5) Salesforce Techbook https://www.youtube.com/@salesforcetechbook
6) Salesforce https://www.youtube.com/@salesforce
7) Path to code https://www.youtube.com/@PathtoCode
8) Salesforce Hulk https://www.youtube.com/@SalesforceHulk
9) Salesforce Codex https://www.youtube.com/@SalesforceCodex
10) Salesforce Ben https://www.youtube.com/@OfficialSFBen
Solution: There are 2 ways to enforce FLS in SOQL query
1)Using USER_MODE
2)WITH SECURITY_ENFORCED clause
Using USER_MODE:
Example: run the below code in execute anonymous window
List<Account> lstAccount = new List<Account>();
lstAccount = [Select id,name from Account with USER_MODE];
system.debug('No of Accounts: '+lstAccount.size());
SELECT Id,name from Account with USER_MODE
Output:
Using WITH SECURITY_ENFORCED clause:
Example: run the below code in execute anonymous window
List<Account> lstAccount = new List<Account>();
lstAccount = [Select id,name from Account with SECURITY_ENFORCED];
system.debug('No of Accounts: '+lstAccount.size());
Note: Salesforce recommends using the USER_MODE than WITH SECURITY_ENFORCED as it has additional advantages
1) USER_MODE accounts for polymorphic fields as well where as SECURITY_ENFORCED donot account for it.
2)USER_MODE returns all the FLS errors where as SECURITY_ENFORCED returns only the first.
Refer to the salesforce link for more details
Solution: Using tooling api ,the validation rules can be queried.
Example: Use the following query in developer console by enabling the tooling api
SELECT Id, Active, Description, EntityDefinition.QualifiedApiName, ErrorDisplayField, ErrorMessage,ValidationName FROM ValidationRule
Output:
To filter validation rules for a specific object, use EntityDefinition.QualifiedApiName(object api name) in where clause of query
Example:
SELECT Id, Active, Description, EntityDefinition.QualifiedApiName, ErrorDisplayField, ErrorMessage,ValidationName FROM ValidationRule where EntityDefinition.QualifiedAPiName='A__c'
Output:
Solution:
Step1: Import the label in LWC using the below import
import labelname from "@salesforce/label/labelreference";
Step2: create label object as below
label ={
myblogURL
}
Reference the custom label in html file using label.labelname.
Example:
customLabelInLWC.html:
<template>
<lightning-card>
<h1> Custom Label value :{label.myblogURL}</h1>
</lightning-card>
</template>
customLabelInLWC.js:
import { LightningElement } from 'lwc';
import myblogURL from "@salesforce/label/c.Blog_URL";
export default class CustomLabelInLWC extends LightningElement {
label ={
myblogURL
}
}
customLabelInLWC.js-meta.xml:
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__RecordPage</target>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Output:
Solution: Need to enable notes feature in order to add notes related list
Step1: we need to enable notes feature first.
Go to setup --> Feature Settings --> Sales --> Notes Settings --> enable the 'Enable Notes' checkbox.
Step 2: Add the Notes related list to the respective page layout
That's it. You will be able to see Notes related list to add new notes.
Enjoy learning salesforce.
There are 2 ways to know this.
Solution1: Login into the org and Go to the setup --> System Overview.
Here you will find the required details.
Solution2: Run the piece of code in execute anonymous windows of Developer console
Map<String, SObjectType> sObjects = Schema.getGlobalDescribe();
Integer noOfCustomObjects = 0;
for (SObjectType obj : sObjects.values())
{
if(obj.getDescribe().isCustom() == true) {
noOfCustomObjects = noOfCustomObjects+1;
//system.debug(obj.getDescribe().getName());
}
}
System.debug('Number of Custom Objects: '+noOfCustomObjects);
Output:
Lightning Messaging Service: It is used to communicate between the visualforce pages, aura components and Lightning web Components. It can be used to communicate between one aura component and one Lightning web component as well and also between one visualforce page and one aura component as well.
Example: In this example you can see how a message is communicated from one lightning web component to other lightning web componentSolution: Open the visual studio code and go to help and About as shown in the image.
A popup will show the required details.
Solution: In this example, will show by installing the salesforce extension pack
Open visual studio code and then go to the extensions icon as shown in image below and search for salesforce extension pack.
Right click on particular extension, then you will get an option to install other versions as shown in image.
Select any version from this and install.
Note: In case if your not getting option to show other versions, install and then try again to change to other version by following above steps.