When working on visualforce pages, there will be a requirement to get to know the sObject name of a record on which you are working. In lightning experience, you will get to know to know the sObject directly just like recordId. But such option is not available in classic version’s visualforce pages.
Continue reading “sObject Name from RecordId in Apex Class”Tag: Apex class
Calling Apex Method with Parameters from a Lightning Web Component
There will be ample scenarios where a developer must customize things in salesforce to meet the business requirement. Customization in Lightning Web Component (LWC) can be done in multiple ways based on requirement. One is using lightning-record-edit-form and lightning-record-form. With these developers will have very minimal control over the component. Another way is by calling a server-side method. With this, developers will have good control over the component and can achieve complex business requirement. In this blog we will see how we can call a server Apex Method with parameters from an LWC JavaScript(.JS) file.
There are few things to note when you want to call an apex method.
- Importing the Server-side method (apex class).
- Calling a Server-side method from JS method.
- Fetching the value that is returned.
Access Modifiers in Salesforce
Access modifiers are used in apex class in salesforce. Similar to Java programming, Salesforce supports 4 different access modifiers in salesforce.
- private
- protected
- public
- global
Apex Class, Variables, Constructor & Methods in Salesforce.
If you know Java or Dotnet applications, then you may observe that everything is written as a class. There are different access levels. You can also define class within a class just like inner class and outer class etc.
Salesforce also provides similar syntax that is followed in Java. Syntax can be to defining a class or variables in class or a wrapper class everything is similar to the syntax followed in Java programming.
Let us see a class and things that can be done in a class in Salesforce.
public class A_Class_Name{
// Variables
public static string a_Variable {get;set;}
// Constructor
public A_Class_Name(){
// Constructor business logic code
}
// Methods
public void a_Method_Name(Integer a_Variable1, Ingeter a_Variable2){
// Business logic code
}
}
Continue reading “Apex Class, Variables, Constructor & Methods in Salesforce.” 