You need to sign in to do that
Don't have an account?
Lukesh Karmore
why we use parameters in apex class
for ex-
@HttpPost
global static ID createCase(String subject, String status, String origin, String priority) {
Case thisCase = new Case(
Subject=subject, Status=status, Origin=origin, Priority=priority);
insert thisCase;
return thisCase.Id;
}
why we use this parameters like "String subject, String status, String origin"
thank you
@HttpPost
global static ID createCase(String subject, String status, String origin, String priority) {
Case thisCase = new Case(
Subject=subject, Status=status, Origin=origin, Priority=priority);
insert thisCase;
return thisCase.Id;
}
why we use this parameters like "String subject, String status, String origin"
thank you
Optional: Modifiers, such as public or protected.
Required: The data type of the value returned by the method, such as String or Integer. Use void if the method does not return a value.
Required: A list of input parameters for the method, separated by commas, each preceded by its data type, and enclosed in parentheses (). If there are no parameters, use a set of empty parentheses. A method can only have 32 input parameters.
Required: The body of the method, enclosed in braces {}. All the code for the method, including any local variable declarations, is contained here.
You need to use the following syntax when defining a method:
As you can see each input parameter is preceded by its data type
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_defining_methods.htm
Let me know if this helps. If it does, please mark this answer as Best. It may help others in the community. Thank You!