Questions tagged [access-modifier]

Apex allows you to use the private, protected, public, and global access modifiers when defining methods and variables.

Filter by
Sorted by
Tagged with
2 votes
1 answer
188 views

Accessing Private Setters Through Client Code

While reading the docs on apex properties I noticed that you can use access modifiers on class instance property getters / setters. While playing around with private setters and running a few examples ...
Ricky Viejo's user avatar
0 votes
1 answer
228 views

should exception's inner class be public or private

Scenario: I have 1 APEX class, in which I have inner class extending exception, as can be seen below: public with sharing class ClassA{ PUBLIC/PRIVATE class ClassBException extends ClassCException {...
user43598's user avatar
  • 447
7 votes
1 answer
2k views

Accessing public class from different Package in same Namespace

Supposedly, it now should be possible to access a public class from different packages within the same namespace: Multiple packages per namespace, so you can better organize your source and easily ...
NSjonas's user avatar
  • 10k
0 votes
1 answer
2k views

Opportunity team access

I have given opportunity team member just read permission but he is also able to edit the fields. What might be the reason? The user is not in accounts team or with any special access as well.
Kanishka Jaroli's user avatar
9 votes
1 answer
7k views

What's the practical difference between using global and public access modifiers?

What is the difference between global and public access modifier in apex? I tried googling but still not able to understand.. Any example will be most helpfull.. Thanks
Akshit Gupta's user avatar
3 votes
1 answer
2k views

When to use Protected modifier

From the developer guides we have the following definition: This means that the method or variable is visible to any inner classes in the defining Apex class, and to the classes that extend the ...
M guy's user avatar
  • 763
5 votes
3 answers
4k views

Overriding a global method with a public method

When you define an abstract method of a class as public or global, an attempt to change the access modifier to protected or private when overriding the method produces a compile time error: Cannot ...
martin's user avatar
  • 12.6k
0 votes
1 answer
358 views

Question on access Modifiers

How can we conclude that using public modifier in the apex code enables us to call them anywhere within the application or namespace but not outside the application or namespace.Consider I'm not ...
Prasanth Srinivasan's user avatar
0 votes
1 answer
2k views

Custom lightning component is not accessible?

I have developed a Custom Lightning component: Intake form, which has input fields of custom objects. I am using this component on my Community(Napili)'s page which is publicly accessible. This ...
Arnold Jr.'s user avatar
  • 1,491
0 votes
3 answers
5k views

Accessing Apex Class'es Private methods from Test Methods

Can you help me to solve the issue and understand it better as I am new to Coding world. I know the issue is because the Apex Class Method's Access modifier "Private" causing the trouble, as I am ...
Robert Thomas's user avatar
1 vote
4 answers
2k views

How to debug Private Method in Developer Console

I have a private method with parameter, How can i debug the below code using Developer Console. Example : public class TestExam { public static void updateRecord(String name) { } } ...
Sfdcprgmr's user avatar
  • 405
13 votes
3 answers
8k views

When is it appropriate to use the @TestVisible Annotation

So from the docs I understand that @TestVisible is used to allow Unit Tests access to private and protected methods. What I was wondering is, when is it appropriate to use this annotation? For ...
Dan Jones's user avatar
  • 7,147
2 votes
2 answers
2k views

Changing access modifiers to accomodate unit tests

I've noticed that when writing classes, it will often be my first impulse to make certain properties private since they wouldn't need to be referenced by other classes. Take for example a class that ...
martin's user avatar
  • 12.6k
4 votes
1 answer
7k views

Must a class implementing a global interface also be global?

As stated in the title, when I implement a global interface, do I need to make the implementing class global, for example when implementing Schedulable or Database.Batchable<SObject>? global ...
PartOfTheOhana's user avatar
4 votes
0 answers
807 views

Variable is not visible: [controller].field_disp

I have a managed package which uses a VF page and controller. This works fine in the developer environment, but starts throwing an error in the installed env. Variable is not visible: [namespace....
Prady's user avatar
  • 12.2k
5 votes
1 answer
118 views

Tooling API SymbolTable contains "private" visibility modifiers instead of "protected"

When I query SymbolTable using Tooling API there are not any protected modifiers at all! Every protected word is replaced with private. The field classBody shows all protected keywords as they are ...
Liudmila Likhovid's user avatar
1 vote
0 answers
665 views

Account Team Access functionality

I have a question on Account access setting while adding Account Team. I have Account sharing rule that provides Read-Write access to a Role (R1). User U1 is with Role R1 U1 logs and can see the ...
Vivek's user avatar
  • 11
2 votes
1 answer
981 views

Is it possible to automate the deactivation of users from an external feed or API integration?

Large enterprise customers often request that we integrate with their internal audit-based access control list processes. Here is a general requirements summary: Step 1: Automate the export of all ...
Steve Richardson's user avatar
3 votes
2 answers
587 views

Restrict VIsualForce page access from Custom Tab

My question is about VisualForce page availability in Custom Tabs. I have a VisualForce page inside my managed package and I'd like to know if there is a way to prevent adding my pages to Custom Tab ...
Mike Raven's user avatar
  • 2,133
8 votes
1 answer
794 views

Access modifiers on sObject properties

Consider the following two classes. The first has simply a private Test__c and its constructor fills it in. The second class uses the first one and creates a Test__c object before instantiating the B ...
zdropic's user avatar
  • 1,178