Skip to content

Commit 579286d

Browse files
authored
Bugfix for Name-Shadowing Issues with the Schema Namespace (#608)
* Added custom Account class (name shadowing), updated all references to 'Account' to instead use 'Schema.Account' * Added custom AuthSession class (name shadowing), updated all references to 'AuthSession' to instead use 'Schema.AuthSession' * Added custom LoginHistory class (name shadowing), updated all references to 'LoginHistory' to instead use 'Schema.LoginHistory' * Added custom Organization class (name shadowing), updated all references to 'Organization' to instead use 'Schema.Organization' * Added custom Profile class (name shadowing), updated all references to 'Profile' to instead use 'Schema.Profile' * Added custom Topic and TopicAssignment classes (name shadowing), updated all references to 'Topic' and 'TopicAssignment' to instead use 'Schema.Topic' and 'Schema.TopicAssignment' * Added custom User class (name shadowing), updated all references to 'User' to instead use 'Schema.User' * Updated some inconsistent uses of 'Network' to instead use 'Schema.Network' * Moved name shadowing classes to a dedicated name-shadowing subdirectory * Regenerated ApexDocs so the fully qualified class names (e.g., Schema.Organization) are used in the docs
1 parent 2735d4e commit 579286d

120 files changed

Lines changed: 686 additions & 533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.
77

8-
## Unlocked Package - v4.12.4
8+
## Unlocked Package - v4.12.5
99

10-
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001Mk5KQAS)
11-
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001Mk5KQAS)
10+
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001Mk5PQAS)
11+
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001Mk5PQAS)
1212
[![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)
1313

14-
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001Mk5KQAS`
14+
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001Mk5PQAS`
1515

16-
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001Mk5KQAS`
16+
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001Mk5PQAS`
1717

1818
---
1919

config/experience-cloud/classes/MicrobatchSelfRegController.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MicrobatchSelfRegController {
2323
String profileId = null; //to be filled by customer
2424
String UUID;
2525

26-
User u = new User();
26+
Schema.User u = new Schema.User();
2727
u.Username = userName;
2828
u.Email = email;
2929
u.FirstName = firstName;
@@ -35,9 +35,9 @@ public class MicrobatchSelfRegController {
3535
u.LanguageLocaleKey = 'en_US';
3636
u.EmailEncodingKey = 'UTF-8';
3737

38-
Account acc = new Account();
38+
Schema.Account acc = new Schema.Account();
3939
acc.Name = 'Account for ' + lastName;
40-
Contact c = new Contact();
40+
Schema.Contact c = new Schema.Contact();
4141
c.lastName = lastName;
4242

4343
try {

config/experience-cloud/classes/MyProfilePageController.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Guest users are never able to access this page.
44
*/
55
public with sharing class MyProfilePageController {
6-
private User user;
6+
private Schema.User user;
77
private boolean isEdit = false;
88

9-
public User getUser() {
9+
public Schema.User getUser() {
1010
return user;
1111
}
1212

config/experience-cloud/classes/MyProfilePageControllerTest.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public with sharing class MyProfilePageControllerTest {
77
@IsTest(SeeAllData=true)
88
static void testSave() {
99
// Modify the test to query for a portal user that exists in your org
10-
List<User> existingPortalUsers = [SELECT id, profileId, userRoleId FROM User WHERE UserRoleId != NULL AND UserType = 'CustomerSuccess'];
10+
List<Schema.User> existingPortalUsers = [SELECT id, profileId, userRoleId FROM User WHERE UserRoleId != NULL AND UserType = 'CustomerSuccess'];
1111

1212
if (existingPortalUsers.isEmpty()) {
13-
User currentUser = [
13+
Schema.User currentUser = [
1414
SELECT id, title, firstname, lastname, email, phone, mobilephone, fax, street, city, state, postalcode, country
1515
FROM User
1616
WHERE id = :System.UserInfo.getUserId()
@@ -33,7 +33,7 @@ public with sharing class MyProfilePageControllerTest {
3333
currentUser = [SELECT id, fax FROM User WHERE id = :currentUser.Id];
3434
// System.Assert.isTrue(currentUser.fax == randFax);
3535
} else {
36-
User existingPortalUser = existingPortalUsers[0];
36+
Schema.User existingPortalUser = existingPortalUsers[0];
3737
String randFax = Math.rint(Math.random() * 1000) + '5551234';
3838

3939
System.runAs(existingPortalUser) {

config/experience-cloud/classes/SiteRegisterController.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public with sharing class SiteRegisterController {
4141
ApexPages.addMessage(msg);
4242
return null;
4343
}
44-
User u = new User();
44+
Schema.User u = new Schema.User();
4545
u.Username = username;
4646
u.Email = email;
4747
u.CommunityNickname = communityNickname;

docs/apex/Configuration/LoggerParameter.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,43 +52,43 @@ Controls if Nebula Logger queries `ApexClass` data. When set to `false`, any `Ap
5252

5353
#### `QUERY_AUTH_SESSION_DATA``Boolean`
5454

55-
Controls if Nebula Logger queries `AuthSession` data. When set to `false`, any `AuthSession` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryAuthSessionData`, or `true` as the default
55+
Controls if Nebula Logger queries `Schema.AuthSession` data. When set to `false`, any `Schema.AuthSession` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryAuthSessionData`, or `true` as the default
5656

5757
#### `QUERY_AUTH_SESSION_DATA_SYNCHRONOUSLY``Boolean`
5858

59-
Controls if Nebula Logger queries `AuthSession` data synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `AuthSession` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryAuthSessionDataSynchronously`, or `true` as the default
59+
Controls if Nebula Logger queries `Schema.AuthSession` data synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Schema.AuthSession` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryAuthSessionDataSynchronously`, or `true` as the default
6060

6161
#### `QUERY_FLOW_DEFINITION_VIEW_DATA``Boolean`
6262

6363
Controls if Nebula Logger queries `FlowDefinitionView` data. When set to `false`, any `FlowDefinitionView` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryFlowDefinitionViewData`, or `true` as the default
6464

6565
#### `QUERY_NETWORK_DATA``Boolean`
6666

67-
Controls if Nebula Logger queries `Network` data. When set to `false`, any `Network` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryNetworkData`, or `true` as the default
67+
Controls if Nebula Logger queries `Schema.Network` data. When set to `false`, any `Schema.Network` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryNetworkData`, or `true` as the default
6868

6969
#### `QUERY_NETWORK_DATA_SYNCHRONOUSLY``Boolean`
7070

71-
Controls if Nebula Logger queries `Network` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Network` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryNetworkDataSynchronously`, or `true` as the default
71+
Controls if Nebula Logger queries `Schema.Network` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Schema.Network` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryNetworkDataSynchronously`, or `true` as the default
7272

7373
#### `QUERY_ORGANIZATION_DATA``Boolean`
7474

75-
Controls if Nebula Logger queries `Organization` data. When set to `false`, any `Organization` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryOrganizationData`, or `true` as the default
75+
Controls if Nebula Logger queries `Schema.Organization` data. When set to `false`, any `Schema.Organization` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryOrganizationData`, or `true` as the default
7676

7777
#### `QUERY_ORGANIZATION_DATA_SYNCHRONOUSLY``Boolean`
7878

79-
Indicates if Nebula Logger queries `Organization` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Organization` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryOrganizationDataSynchronously`, or `true` as the default
79+
Indicates if Nebula Logger queries `Schema.Organization` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Schema.Organization` fields on `LogEntryEvent__e` will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryOrganizationDataSynchronously`, or `true` as the default
8080

8181
#### `QUERY_RELATED_RECORD_DATA``Boolean`
8282

8383
Controls if Nebula Logger queries data for records synthetically related to a `LogEntry__c` via `LogEntry__c.RecordId__c`. When set to `false`, any fields on `LogEntry__c` related to `LogEntry__c.RecordId__c` not be populated Controlled by the custom metadata record `LoggerParameter.QueryRelatedRecordData`, or `true` as the default
8484

8585
#### `QUERY_USER_DATA``Boolean`
8686

87-
Controls if Nebula Logger queries `User` data. When set to `false`, any `User` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryUserData`, or `true` as the default
87+
Controls if Nebula Logger queries `Schema.User` data. When set to `false`, any `Schema.User` fields on `LogEntryEvent__e` and `Log__c` will not be populated Controlled by the custom metadata record `LoggerParameter.QueryUserData`, or `true` as the default
8888

8989
#### `QUERY_USER_DATA_SYNCHRONOUSLY``Boolean`
9090

91-
Indicates if Nebula Logger queries `User` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `User` fields on `LogEntryEvent__e` that rely on querying will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryUserDataSynchronously`, or `true` as the default
91+
Indicates if Nebula Logger queries `Schema.User` data is queried synchronously &amp; populated on `LogEntryEvent__e` records. When set to `false`, any `Schema.User` fields on `LogEntryEvent__e` that rely on querying will not be populated - the data will instead be queried asynchronously and populated on any resulting `Log__c` records. Controlled by the custom metadata record `LoggerParameter.QueryUserDataSynchronously`, or `true` as the default
9292

9393
#### `SEND_ERROR_EMAIL_NOTIFICATIONS``Boolean`
9494

@@ -112,7 +112,7 @@ Indicates if Platform Cache is used to cache organization &amp; session data in
112112

113113
#### `USE_TOPICS_FOR_TAGS``Boolean`
114114

115-
Indicates if Logger&apos;s tagging will use `Topic` and `TopicAssignment` for storing tags (when `true`), or uses Nebula Logger&apos;s custom objects `LoggerTag__c` and `LogEntryTag__c` (when `false`) Controlled by the custom metadata record `LoggerParameter.UseTopicsForTags`, or `false` as the default
115+
Indicates if Logger&apos;s tagging will use `Schema.Topic` and `Schema.TopicAssignment` for storing tags (when `true`), or uses Nebula Logger&apos;s custom objects `LoggerTag__c` and `LogEntryTag__c` (when `false`) Controlled by the custom metadata record `LoggerParameter.UseTopicsForTags`, or `false` as the default
116116

117117
---
118118

docs/apex/Log-Management/LogManagementDataSelector.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -337,49 +337,49 @@ List&lt;Log\_\_c&gt;
337337

338338
The list of matching `Log__c` records
339339

340-
#### `getProfilesById(List<Id> profileIds)``List<Profile>`
340+
#### `getProfilesById(List<Id> profileIds)``List<Schema.Profile>`
341341

342-
Returns a `List&lt;Profile&gt;` of records with the specified profile IDs
342+
Returns a `List&lt;Schema.Profile&gt;` of records with the specified profile IDs
343343

344344
##### Parameters
345345

346-
| Param | Description |
347-
| ------------ | -------------------------------------------------- |
348-
| `profileIds` | The list of `ID` of the `Profile` records to query |
346+
| Param | Description |
347+
| ------------ | --------------------------------------------------------- |
348+
| `profileIds` | The list of `ID` of the `Schema.Profile` records to query |
349349

350350
##### Return
351351

352352
**Type**
353353

354-
List&lt;Profile&gt;
354+
List&lt;Schema.Profile&gt;
355355

356356
**Description**
357357

358-
The list of matching `Profile` records
358+
The list of matching `Schema.Profile` records
359359

360-
#### `getProfilesByNameSearch(String searchTerm)``List<Profile>`
360+
#### `getProfilesByNameSearch(String searchTerm)``List<Schema.Profile>`
361361

362-
Returns a `List&lt;Profile&gt;` of records where the profile&apos;s names partially matches the specified search term
362+
Returns a `List&lt;Schema.Profile&gt;` of records where the profile&apos;s names partially matches the specified search term
363363

364364
##### Parameters
365365

366-
| Param | Description |
367-
| ------------ | --------------------------------------------------------------- |
368-
| `searchTerm` | The `String` search term to use for searching `Profile` records |
366+
| Param | Description |
367+
| ------------ | ---------------------------------------------------------------------- |
368+
| `searchTerm` | The `String` search term to use for searching `Schema.Profile` records |
369369

370370
##### Return
371371

372372
**Type**
373373

374-
List&lt;Profile&gt;
374+
List&lt;Schema.Profile&gt;
375375

376376
**Description**
377377

378-
The list of matching `Profile` records
378+
The list of matching `Schema.Profile` records
379379

380-
#### `getQueuesByDeveloperName(List<String> queueDeveloperNames)``List<Group>`
380+
#### `getQueuesByDeveloperName(List<String> queueDeveloperNames)``List<Schema.Group>`
381381

382-
Returns a `List&lt;Group&gt;` of records with the specified developer names and type == &apos;Queue&apos;
382+
Returns a `List&lt;Schema.Group&gt;` of records with the specified developer names and type == &apos;Queue&apos;
383383

384384
##### Parameters
385385

@@ -391,11 +391,11 @@ Returns a `List&lt;Group&gt;` of records with the specified developer names and
391391

392392
**Type**
393393

394-
List&lt;Group&gt;
394+
List&lt;Schema.Group&gt;
395395

396396
**Description**
397397

398-
The list of matching `Group` records
398+
The list of matching `Schema.Group` records
399399

400400
#### `getRecordLogEntries(Id recordId, String fieldsClause, String orderByClause, Integer rowLimit)``List<LogEntry__c>`
401401

@@ -440,9 +440,9 @@ List&lt;LoggerTag\_\_c&gt;
440440

441441
The list of matching `LoggerTag__c` records
442442

443-
#### `getTopicsByName(Set<String> topicNames)``List<Topic>`
443+
#### `getTopicsByName(Set<String> topicNames)``List<Schema.Topic>`
444444

445-
Returns a list of `Topic` records with one of the specified topic names
445+
Returns a list of `Schema.Topic` records with one of the specified topic names
446446

447447
##### Parameters
448448

@@ -454,55 +454,55 @@ Returns a list of `Topic` records with one of the specified topic names
454454

455455
**Type**
456456

457-
List&lt;Topic&gt;
457+
List&lt;Schema.Topic&gt;
458458

459459
**Description**
460460

461-
The list of matching `Topic` records
461+
The list of matching `Schema.Topic` records
462462

463-
#### `getUsersById(List<Id> userIds)``List<User>`
463+
#### `getUsersById(List<Id> userIds)``List<Schema.User>`
464464

465-
Returns a `List&lt;User&gt;` of records with the specified user IDs
465+
Returns a `List&lt;Schema.User&gt;` of records with the specified user IDs
466466

467467
##### Parameters
468468

469-
| Param | Description |
470-
| --------- | ----------------------------------------------- |
471-
| `userIds` | The list of `ID` of the `User` records to query |
469+
| Param | Description |
470+
| --------- | ------------------------------------------------------ |
471+
| `userIds` | The list of `ID` of the `Schema.User` records to query |
472472

473473
##### Return
474474

475475
**Type**
476476

477-
List&lt;User&gt;
477+
List&lt;Schema.User&gt;
478478

479479
**Description**
480480

481-
The list of matching `User` records
481+
The list of matching `Schema.User` records
482482

483-
#### `getUsersByNameSearch(String searchTerm)``List<User>`
483+
#### `getUsersByNameSearch(String searchTerm)``List<Schema.User>`
484484

485-
Returns a `List&lt;User&gt;` of records where the User&apos;s names or username partially matches the specified search term
485+
Returns a `List&lt;Schema.User&gt;` of records where the User&apos;s names or username partially matches the specified search term
486486

487487
##### Parameters
488488

489-
| Param | Description |
490-
| ------------ | ------------------------------------------------------------ |
491-
| `searchTerm` | The `String` search term to use for searching `User` records |
489+
| Param | Description |
490+
| ------------ | ------------------------------------------------------------------- |
491+
| `searchTerm` | The `String` search term to use for searching `Schema.User` records |
492492

493493
##### Return
494494

495495
**Type**
496496

497-
List&lt;User&gt;
497+
List&lt;Schema.User&gt;
498498

499499
**Description**
500500

501-
The list of matching `User` records
501+
The list of matching `Schema.User` records
502502

503-
#### `getUsersByUsername(List<String> usernames)``List<User>`
503+
#### `getUsersByUsername(List<String> usernames)``List<Schema.User>`
504504

505-
Returns a `List&lt;User&gt;` of records with the specified usernames (`Schema.User.Username`)
505+
Returns a `List&lt;Schema.User&gt;` of records with the specified usernames (`Schema.User.Username`)
506506

507507
##### Parameters
508508

@@ -514,10 +514,10 @@ Returns a `List&lt;User&gt;` of records with the specified usernames (`Schema.Us
514514

515515
**Type**
516516

517-
List&lt;User&gt;
517+
List&lt;Schema.User&gt;
518518

519519
**Description**
520520

521-
Tje list of matching `User` records
521+
Tje list of matching `Schema.User` records
522522

523523
---

docs/apex/Log-Management/LoggerSettingsController.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ Deletes the specified `LoggerSettings__c` record
4848
| ---------------- | -------------------- |
4949
| `settingsRecord` | The record to delete |
5050

51-
#### `getOrganization()``Organization`
51+
#### `getOrganization()``Schema.Organization`
5252

53-
Returns the `Organization` record for the current environment
53+
Returns the `Schema.Organization` record for the current environment
5454

5555
##### Return
5656

5757
**Type**
5858

59-
Organization
59+
Schema.Organization
6060

6161
**Description**
6262

63-
The current environment&apos;s `Organization` record
63+
The current environment&apos;s `Schema.Organization` record
6464

6565
#### `getPicklistOptions()``LoggerSettingsPicklistOptions`
6666

@@ -106,10 +106,10 @@ searchForSetupOwner description
106106

107107
##### Parameters
108108

109-
| Param | Description |
110-
| ---------------- | --------------------------------------------- |
111-
| `setupOwnerType` | The object to search (`Profile` or `User`) |
112-
| `searchTerm` | The search term to use when searching records |
109+
| Param | Description |
110+
| ---------------- | -------------------------------------------------------- |
111+
| `setupOwnerType` | The object to search (`Schema.Profile` or `Schema.User`) |
112+
| `searchTerm` | The search term to use when searching records |
113113

114114
##### Return
115115

@@ -207,7 +207,7 @@ The sorting result
207207

208208
#### LoggerSettingsController.SetupOwnerSearchResult class
209209

210-
Inner class used for returning search results for `Profile` and `User` records
210+
Inner class used for returning search results for `Schema.Profile` and `Schema.User` records
211211

212212
---
213213

docs/apex/Logger-Engine/Logger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3634,7 +3634,7 @@ LoggerSettings\_\_c
36343634

36353635
LoggerSettings\_\_c - The current user&apos;s instance of the custom settings
36363636

3637-
#### `getUserSettings(User loggingUser)``LoggerSettings__c`
3637+
#### `getUserSettings(Schema.User loggingUser)``LoggerSettings__c`
36383638

36393639
**This is only intended to be used internally by Nebula Logger, and is subject to change.** Returns the specified user&apos;s instance of `LoggerSettings__c`
36403640

0 commit comments

Comments
 (0)