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

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 9
    Replies

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. I am currently trying to check a value of a field on a  List of Sobjects. If any of Sobject in the list has the field value of, say Status, as 'Not Approved', I can continue the workflow. Else, if it does not, I need to break the flow and return a String 'Operation cannot be done'.

So I came up with a for loop. Here is the sample : 

Boolean continueWorkflow = false;
for(CustomSObject item : CustomSObjectsList){
    if(item.Status == 'Not Approved'){
         continueWorkFlow = true; 
         break;
     }
if(!continueWorkFlow){
   return 'Operation cannot be done'

Is there any other way to check the status field of the Sobject from the List of Sobjects ? 
 

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,

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,

I am new to Salesforce Apex Development. I am currently trying to check a value of a field on a  List of Sobjects. If any of Sobject in the list has the field value of, say Status, as 'Not Approved', I can continue the workflow. Else, if it does not, I need to break the flow and return a String 'Operation cannot be done'.

So I came up with a for loop. Here is the sample : 

Boolean continueWorkflow = false;
for(CustomSObject item : CustomSObjectsList){
    if(item.Status == 'Not Approved'){
         continueWorkFlow = true; 
         break;
     }
if(!continueWorkFlow){
   return 'Operation cannot be done'

Is there any other way to check the status field of the Sobject from the List of Sobjects ? 
 

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