• James George 00700
  • NEWBIE
  • 110 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 17
    Replies
Hi Friends,
I'm trying to compile a list of difference between different salesforce terms/items to keep in a single place for reference purpose, does anybody have any more to add (Any difference is fine)
For eg:
 1. Difference between Global and Public in apex language
    Public:
This means the method or variable can be used by any Apex in this application or namespace.
    Global:
This means the method or variable can be used by any Apex code that has access to the class, not just the Apex code in the same application. This access modifier should be used for any method that needs to be referenced outside of the application, either in the SOAP API or Batch Apex or by other Apex code. If you declare a method or variable as global, you must also declare the class that contains it as global.
2. Diffrence between isBlank and isNull
ISBLANK() has the same functionality as ISNULL(), but also supports text fields. Salesforce will continue to support ISNULL, so you do not need to change any existing formulas. ISNULL(): Text fields are never null, so using ISNULL() with a text field always returns false

Thanks,
James George
Hi Friends,
Is it possible or easy way to do System.Debug dynamic SOQL statements, want to know what will be the internal parameters build in the query before executing
For eg:
 
trigger AccountDeletion on Account (before delete) {
   
    // Prevent the deletion of accounts if they have related opportunities.
    for (Account a : [SELECT Id FROM Account
                     WHERE Id IN (SELECT AccountId FROM Opportunity) AND
                     Id IN :Trigger.old]) {
        Trigger.oldMap.get(a.Id).addError(
            'Cannot delete account with related opportunities.');
    }
    
}


Can somebody provide a sample code to have a debug log in the For loop, so I can know what are the parameters get passed.
or is there any way the SOQL query to be passed to a string so I can see what's going on.

Thanks,
James George

Hi Friends,
Please let me know if there is any way to customize/add/remove items to the Setup Home page. those scrollable items iniside the red border in my screenshot looks to me unncecessary.
Please see the screenshot.
User-added image
Let me know your comments,
Thanks,
JG
Hi Friends,
Did anybody faced this issue, I am trying to create a project in VS Code, got the below error.
Please let me know your valuable comments.
Starting SFDX: Create Project

18:49:54.38 sfdx force:project:create --projectname MyProject --outputdir c:\SFDX\DevCert2 --template empty
ERROR running force:project:create:  Command failed with exit code 1: npm root -g --prefix c:\SFDX\DevCert2\.yo-repository --loglevel error
'npm' is not recognized as an internal or external command,
operable program or batch file.
18:49:54.942 sfdx force:project:create --projectname MyProject --outputdir c:\SFDX\DevCert2 --template empty
 ended with exit code 1

 
Hi Friends,
Please help me finding this.
I can't find the apex sharing reason, in the object manager. can anybody share some light on this.
User-added image

Thanks
James George
Hi Friends,
Is it possible for APEX to refer formula fields for example refering to a roll-up summary field.

Please let me know your answers.

Thanks,
JG
Hi Friends,
I was trying a test code to insert 50,000 records using the below code, its throwing the limit exception related to dml rows of 10000 reached.

My question is since I specified  false as below
Database.SaveResult[] srList = Database.insert(lstContacts, false);
is this code suppose to insert at least 10000 records, but did'nt do it.

Let me know your comments.


My code below
List<Contact> lstContacts = new List<Contact>();
for(Integer x = 0; x<50000; x++ ){
    Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x);
    lstContacts.add(con);
}
Database.SaveResult[] srList = Database.insert(lstContacts, false);

for (Database.SaveResult sr : srList) {
    if (sr.isSuccess()) {
        // Operation was successful, so get the ID of the record that was processed
        System.debug('Successfully inserted account. Account ID: ' + sr.getId());
    }
    else {
        // Operation failed, so get all errors                
        for(Database.Error err : sr.getErrors()) {
            System.debug('The following error has occurred.');                    
            System.debug(err.getStatusCode() + ': ' + err.getMessage());
            System.debug('Account fields that affected this error: ' + err.getFields());
        }
    }
}

Thanks
JG
 
Hi Friends,
I cannot see most of the annotations autopopulating in VS Code.
Some are coming like @AuraEnabled, but for eg @InvocableMethod is not populating

Kindly let me know what can be the reason.

Thanks,
JG
Hi Friends,
Let me know if there is any way to convert Custom Object to Standard Object.

Let me know your comments

Thanks,
JG
Hi Friends,
Why Cross-object formula fields are able to pull the data even if the user have no access to it.

Is this a kind of security breach or a feature?

Let me know your comments.

Thanks
JG
Hi Friends,
Just to know if, the Apex Interactive Debugger supports the free developer editions or trailhead support.
Wish to use it with VS code for debugging, Please let me know the comments.
Apex Interactive Debugger
Hi Friends,
I  tried to run a simple hello world using the code below

string tempvar = 'Enter_your_name_here';
System.debug('Hello World!');
System.debug('My name is ' + tempvar);

The output after SFDX: Execute Anonymous Apex with Editor Contents
is showing the same code I have written without any value assignments

Below is the return from the execution
48.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO
Execute Anonymous: // Use .apex files to store anonymous Apex.
Execute Anonymous: // You can execute anonymous Apex in VS Code by selecting the
Execute Anonymous: //     apex text and running the command:
Execute Anonymous: //     SFDX: Execute Anonymous Apex with Currently Selected Text
Execute Anonymous: // You can also execute the entire file by running the command:
Execute Anonymous: //     SFDX: Execute Anonymous Apex with Editor Contents
Execute Anonymous: 
Execute Anonymous: string tempvar = 'Enter_your_name_here';
Execute Anonymous: System.debug('Hello World!');
Execute Anonymous: System.debug('My name is ' + tempvar);
00:14:41.21 (21039896)|USER_INFO|[EXTERNAL]|00555000004hwoa|test-qphxury38ylx@example.com|(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)|GMT-07:00
00:14:41.21 (21078526)|EXECUTION_STARTED
00:14:41.21 (21085467)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
00:14:41.21 (21721820)|USER_DEBUG|[9]|DEBUG|Hello World!
00:14:41.21 (21776425)|USER_DEBUG|[10]|DEBUG|My name is Enter_your_name_here
00:14:41.21 (21858188)|CUMULATIVE_LIMIT_USAGE
00:14:41.21 (21858188)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100

Can anybody show some light, what I'm missing?
Hi Friends,
Is it possible for APEX to refer formula fields for example refering to a roll-up summary field.

Please let me know your answers.

Thanks,
JG
Hi Friends,
I'm trying to compile a list of difference between different salesforce terms/items to keep in a single place for reference purpose, does anybody have any more to add (Any difference is fine)
For eg:
 1. Difference between Global and Public in apex language
    Public:
This means the method or variable can be used by any Apex in this application or namespace.
    Global:
This means the method or variable can be used by any Apex code that has access to the class, not just the Apex code in the same application. This access modifier should be used for any method that needs to be referenced outside of the application, either in the SOAP API or Batch Apex or by other Apex code. If you declare a method or variable as global, you must also declare the class that contains it as global.
2. Diffrence between isBlank and isNull
ISBLANK() has the same functionality as ISNULL(), but also supports text fields. Salesforce will continue to support ISNULL, so you do not need to change any existing formulas. ISNULL(): Text fields are never null, so using ISNULL() with a text field always returns false

Thanks,
James George
Hi Friends,
Is it possible or easy way to do System.Debug dynamic SOQL statements, want to know what will be the internal parameters build in the query before executing
For eg:
 
trigger AccountDeletion on Account (before delete) {
   
    // Prevent the deletion of accounts if they have related opportunities.
    for (Account a : [SELECT Id FROM Account
                     WHERE Id IN (SELECT AccountId FROM Opportunity) AND
                     Id IN :Trigger.old]) {
        Trigger.oldMap.get(a.Id).addError(
            'Cannot delete account with related opportunities.');
    }
    
}


Can somebody provide a sample code to have a debug log in the For loop, so I can know what are the parameters get passed.
or is there any way the SOQL query to be passed to a string so I can see what's going on.

Thanks,
James George

Hi Friends,
Please let me know if there is any way to customize/add/remove items to the Setup Home page. those scrollable items iniside the red border in my screenshot looks to me unncecessary.
Please see the screenshot.
User-added image
Let me know your comments,
Thanks,
JG
Hi Friends,
Did anybody faced this issue, I am trying to create a project in VS Code, got the below error.
Please let me know your valuable comments.
Starting SFDX: Create Project

18:49:54.38 sfdx force:project:create --projectname MyProject --outputdir c:\SFDX\DevCert2 --template empty
ERROR running force:project:create:  Command failed with exit code 1: npm root -g --prefix c:\SFDX\DevCert2\.yo-repository --loglevel error
'npm' is not recognized as an internal or external command,
operable program or batch file.
18:49:54.942 sfdx force:project:create --projectname MyProject --outputdir c:\SFDX\DevCert2 --template empty
 ended with exit code 1

 
Hi Friends,
Please help me finding this.
I can't find the apex sharing reason, in the object manager. can anybody share some light on this.
User-added image

Thanks
James George
Hi Friends,
I was trying a test code to insert 50,000 records using the below code, its throwing the limit exception related to dml rows of 10000 reached.

My question is since I specified  false as below
Database.SaveResult[] srList = Database.insert(lstContacts, false);
is this code suppose to insert at least 10000 records, but did'nt do it.

Let me know your comments.


My code below
List<Contact> lstContacts = new List<Contact>();
for(Integer x = 0; x<50000; x++ ){
    Contact con = new Contact(LastName= 'Keller'+x, FirstName='Helen'+x);
    lstContacts.add(con);
}
Database.SaveResult[] srList = Database.insert(lstContacts, false);

for (Database.SaveResult sr : srList) {
    if (sr.isSuccess()) {
        // Operation was successful, so get the ID of the record that was processed
        System.debug('Successfully inserted account. Account ID: ' + sr.getId());
    }
    else {
        // Operation failed, so get all errors                
        for(Database.Error err : sr.getErrors()) {
            System.debug('The following error has occurred.');                    
            System.debug(err.getStatusCode() + ': ' + err.getMessage());
            System.debug('Account fields that affected this error: ' + err.getFields());
        }
    }
}

Thanks
JG
 
Hi Friends,
I cannot see most of the annotations autopopulating in VS Code.
Some are coming like @AuraEnabled, but for eg @InvocableMethod is not populating

Kindly let me know what can be the reason.

Thanks,
JG
Hi Friends,
Let me know if there is any way to convert Custom Object to Standard Object.

Let me know your comments

Thanks,
JG
Hi Friends,
Why Cross-object formula fields are able to pull the data even if the user have no access to it.

Is this a kind of security breach or a feature?

Let me know your comments.

Thanks
JG
Hi Friends,
Just to know if, the Apex Interactive Debugger supports the free developer editions or trailhead support.
Wish to use it with VS code for debugging, Please let me know the comments.
Apex Interactive Debugger
Hi Friends,
I  tried to run a simple hello world using the code below

string tempvar = 'Enter_your_name_here';
System.debug('Hello World!');
System.debug('My name is ' + tempvar);

The output after SFDX: Execute Anonymous Apex with Editor Contents
is showing the same code I have written without any value assignments

Below is the return from the execution
48.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO
Execute Anonymous: // Use .apex files to store anonymous Apex.
Execute Anonymous: // You can execute anonymous Apex in VS Code by selecting the
Execute Anonymous: //     apex text and running the command:
Execute Anonymous: //     SFDX: Execute Anonymous Apex with Currently Selected Text
Execute Anonymous: // You can also execute the entire file by running the command:
Execute Anonymous: //     SFDX: Execute Anonymous Apex with Editor Contents
Execute Anonymous: 
Execute Anonymous: string tempvar = 'Enter_your_name_here';
Execute Anonymous: System.debug('Hello World!');
Execute Anonymous: System.debug('My name is ' + tempvar);
00:14:41.21 (21039896)|USER_INFO|[EXTERNAL]|00555000004hwoa|test-qphxury38ylx@example.com|(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)|GMT-07:00
00:14:41.21 (21078526)|EXECUTION_STARTED
00:14:41.21 (21085467)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
00:14:41.21 (21721820)|USER_DEBUG|[9]|DEBUG|Hello World!
00:14:41.21 (21776425)|USER_DEBUG|[10]|DEBUG|My name is Enter_your_name_here
00:14:41.21 (21858188)|CUMULATIVE_LIMIT_USAGE
00:14:41.21 (21858188)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100

Can anybody show some light, what I'm missing?