• Vishnu Santhosh
  • NEWBIE
  • 65 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies

Hi,

While running the test class for code coverage, I am facing an issue to run it succesfully as it is throwing the below exception :

System.QueryException: Insufficient permissions: secure query included inaccessible field

My guess is that Test class is run in system mode which does not require permissions for field. (Please correct me if i am wrong)

I had also went through the test class to check if any profile/user is mentioned in the test class and that is not the case.

One thing to note is that, Test class is running sucesfully in one org with good code coverage, but its not running on another org and says it failed due to the above mentioned exception.

Any work around/ Idea to overcome this issue ?

Thank you :)

I already have a Sandbox org authorized and set as Default Org.

I need to work on another project and retrieve data from Another org. For doing the same, I created a project with manifest and then ran 'SFDX:Authorize an Org' command.

When i run the same, a notification pops up saying  'SFDX:Authorize an Org Successfully ran' and also, in the Ouput tab, I could see the cli commands and also the status at the end of the line saying 'ended with exit code 0'.

I am expecting a browser to open the login page after the execution of above command, but its not happening.

Could you tell me what am I doing wrong / what I need to do here?

Thank you

Hi,

I am new to Apex Development and am on the way of learning and discovering it more.

Consider this scenario : 
 

Class { 

       Method 1 {
                              try{
                                     //Statement 1
                                     //Statement 2 ......
                                     method2(params)
                                      ...............
                                    }
                                catch(Exception ex) { 
                                       //throws exception here
                                 }
         }

         Method 2 {
                         //Some statements
          }


Will the Try- catch block in Method 1 catches exception if there is any exception/error thrown in the method 2 ?

New to this. Correct me if i am wrong :)

Thank you

Hi Community,

So, After I updated the VSCode recently, this error is getting thrown most of the time either when i try to retrieve 'the source from org' for a single apex class or when i try to 'Retrieve Source in Manifest from Org' from package.xml file.

I think it might get fixed after reinstallation. But that can cost me some time, setting up org, installing extensions again and all.

How can fix this issue ? Help ! 
If you know the solution, please share it.

Hi,

I am new to Salesforce Apex Development and also apex test classes. While i was going through test classes, I got an error. I will explain the logic and scenario : 

@isTest
public class testing(){
  
  @testSetup static void setup(){

   List<id> testId = new List<id>();
   List<Account> testData = new List<Account>();
   List<Account> retrievedData = new List<Account>();
   /**
       some logic is done and testData now has an Account in it
    */
   insert testData;
   }

  @isTest static void testAcc(){
        testData.some function();
      
        retrievedData.somefunction();

        testId.somefunction();
       
      Test.startTest();
      // Logic to query the account inserted
      Test.stopTest();

     }
}

 When i runs the code based on above logic, I get the error that Variable does not exist : testData.Same applies for testId, retrievedData.

How to fix the error? Am i doing the testSetup wrong ? Please guide me on this.

Thank you :)
 

Hi,

I am new to Salesforce Apex Development and am working in VSCode by connecting it to a Sandbox Org. 

I had installed the salesforce extension pack from the extensions. But, sometimes I get notification saying the one extension is taking a lot of time and is causing issues and the whole vscode gets stuck for sometime. So, I though to uninstall some extensions related to Aura and Lightining because currently I am working on the Apex Classes alone.

Is it Okay to use like that? Will that cause an issue ?

If that is the case, Can you help me suggesting the must have extensions in the extension pack considering only Apext classes, Apex test Classes and debugging ?

Hi,

I am new to Salesforce Apex Development and currently working on Apex classes and Apex Test classes alone. To fetch data from org, what I am currently following is to use the SFDX:Retrieve source in manifest from org command in the Package.xml file. So,it retrieves all the data ( including Lighning pages, Aura components,etc). 

I saw there are several types mentioned in the Package.xml file. So my question is how can i fetch the Apex classes alone insteading of fetching all the data into the VSCode from Org ?

Does modifying the package.xml file will do? If so, can you please give a small explanation on that ?

Thank you :)

Hi,

Consider this case where I made changes in a class of an org from the browser. So, to see the changes made in the org to be seen in the VSCode, I need to open the same class and right click > SFDX : Retrieve This Source From Org. I need to do this each time or else, the changes made in the org will be overwritten if i push the class to the org.

How can i auto retrieve the same class once I open in the VSCode without each time right clicking and selecting the Retrieve this source from Org option ? 

If this issue can be solved/approached in another way, kindly suggest me that too.

Thank you :)

Hi Community,

So, After I updated the VSCode recently, this error is getting thrown most of the time either when i try to retrieve 'the source from org' for a single apex class or when i try to 'Retrieve Source in Manifest from Org' from package.xml file.

I think it might get fixed after reinstallation. But that can cost me some time, setting up org, installing extensions again and all.

How can fix this issue ? Help ! 
If you know the solution, please share it.

Hi,

While running the test class for code coverage, I am facing an issue to run it succesfully as it is throwing the below exception :

System.QueryException: Insufficient permissions: secure query included inaccessible field

My guess is that Test class is run in system mode which does not require permissions for field. (Please correct me if i am wrong)

I had also went through the test class to check if any profile/user is mentioned in the test class and that is not the case.

One thing to note is that, Test class is running sucesfully in one org with good code coverage, but its not running on another org and says it failed due to the above mentioned exception.

Any work around/ Idea to overcome this issue ?

Thank you :)

I already have a Sandbox org authorized and set as Default Org.

I need to work on another project and retrieve data from Another org. For doing the same, I created a project with manifest and then ran 'SFDX:Authorize an Org' command.

When i run the same, a notification pops up saying  'SFDX:Authorize an Org Successfully ran' and also, in the Ouput tab, I could see the cli commands and also the status at the end of the line saying 'ended with exit code 0'.

I am expecting a browser to open the login page after the execution of above command, but its not happening.

Could you tell me what am I doing wrong / what I need to do here?

Thank you

Hi,

I am new to Apex Development and am on the way of learning and discovering it more.

Consider this scenario : 
 

Class { 

       Method 1 {
                              try{
                                     //Statement 1
                                     //Statement 2 ......
                                     method2(params)
                                      ...............
                                    }
                                catch(Exception ex) { 
                                       //throws exception here
                                 }
         }

         Method 2 {
                         //Some statements
          }


Will the Try- catch block in Method 1 catches exception if there is any exception/error thrown in the method 2 ?

New to this. Correct me if i am wrong :)

Thank you

Hi Community,

So, After I updated the VSCode recently, this error is getting thrown most of the time either when i try to retrieve 'the source from org' for a single apex class or when i try to 'Retrieve Source in Manifest from Org' from package.xml file.

I think it might get fixed after reinstallation. But that can cost me some time, setting up org, installing extensions again and all.

How can fix this issue ? Help ! 
If you know the solution, please share it.

Hello!
I created a new project with manifest in VS Code, but I am not able to authorize an Org(sandbox) to it. When I run:

sfdx force:auth:web:login --setalias <alias> --instanceurl <sanboxURL> --setdefaultusername

, it opens the authentication screen, then I insert login + password and it redirects me to localhost:1717 with the following error: 

Error authenticating with auth code due to: authentication failure
This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

,in vsc it shows me the following error:

ERROR running auth:web:login:  Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: authentication failure

VS Code Version: 1.56.2
SFDX CLI Version: sfdx-cli/7.102.0 win32-x64 node-v16.1.0
Salesforce Extension Pack: 51.14.0
 

Hi All,

I am working on a scenario where i have 2 objects : Accounts and Order1__c(order1 has a lookup relationship with account).
On deletion of account i am able to delete the related child records. But on undelete i am getting the error.

On undelete
Below is my implementation for the same.

trigger OrderDeletion on Account (before delete,after delete,after undelete) {
    
List<Id> AccIds= new List<Id>();
    
    for(Account acc: trigger.old){
       
        
        AccIds.add(acc.id);
    }
    List<Order1__c> ordlist=[select id,name,Account__c from Order1__c WHERE Account__c in:AccIds ];
    if(ordlist.size()>0)
    delete ordlist;
    
    if(trigger.isAfter && trigger.isUndelete){
        if(ordlist.size()>0)
        undelete ordlist;
        
    }
}
 


 

Hi All,

 

How to write  Formula field in Test class

 

 

Thanks

Anwar

  • September 21, 2012
  • Like
  • 0