Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
6 votes
1 answer
1k 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 ...
user avatar
  • 9,446
0 votes
1 answer
973 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.
user avatar
7 votes
1 answer
4k 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
user avatar
2 votes
1 answer
1k 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 ...
user avatar
  • 703
5 votes
3 answers
2k 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 ...
user avatar
  • 12.2k
0 votes
1 answer
191 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 ...
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 ...
user avatar
  • 1,490
0 votes
3 answers
3k 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 ...
user avatar
1 vote
4 answers
1k 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) { } } ...
user avatar
  • 345
12 votes
3 answers
6k 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 ...
user avatar
  • 7,037
2 votes
2 answers
1k 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 ...
user avatar
  • 12.2k
3 votes
1 answer
6k 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 ...
user avatar
4 votes
0 answers
768 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....
user avatar
  • 11.9k
5 votes
1 answer
107 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 ...
user avatar
1 vote
0 answers
660 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 ...
user avatar
  • 11
2 votes
1 answer
820 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 ...
user avatar
3 votes
2 answers
573 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 ...
user avatar
  • 2,053
8 votes
1 answer
742 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 ...
user avatar
  • 1,168