• Gabriel Martins 13
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies

Hello everyone, I'm facing an issue with the Visual Studio when trying to run any SOQL statment.

Step to reproduce:

1. Create a new file
2. Paste the SOQL statment: SELECT Name FROM Contact
3. Save the file with the extension .soql
4. Highlight  the SOQL statment in the file
5. On comand Pallet Execute SFDX: Execute Anonymous Apex with Currently Selected TEXT

It does not work. I get the golowing error message: Unexpected token 'SELECT'.

Any idea?

thanksUser-added image

The data source fied is populated and the associated cross-object formula as well, however when debugging a test class,  it brings the cross-object formula value null.

Would be possible to read values from cross-object formula fields on a test class?

thanks

Dear Comunity, I hope all of you are safe and sound.

Is there any reason for cross-object formula returns null on apex test execution?

My test updated a field, then the System.debug shows the value from the cross-object formula, but it shows null even after querying it: 

That's the piece of the ciode:

 

Test.startTest();
                
        List<CC__c> cardlist = [SELECT Card_Id_CC__c,Card_Last_Modified_Date__c FROM CC__c WHERE Id = :e.Id];
        CC__c cardtest = cardlist[0];
        cardtest.Card_Id_CC__c = 'card12345'; 
        update cardtest;        
        System.debug(cardlist);
        System.debug('Card Last Modified date - CC__c.Card_Last_Modified_Date__c:  ' +cardtest.Card_Last_Modified_Date__c);
              
        
RG__c rglist2 =[Select Card_Last_Modified_Date__c FROM RG__c WHERE ID=:r.id];
        System.debug('This field must be equal to CC__c.Card_Last_Modified_Date__c '+ rglist2.Card_Last_Modified_Date__c);

 

Thank you all

 

 

 

Hello everyone, I'm facing an issue with the Visual Studio when trying to run any SOQL statment.

Step to reproduce:

1. Create a new file
2. Paste the SOQL statment: SELECT Name FROM Contact
3. Save the file with the extension .soql
4. Highlight  the SOQL statment in the file
5. On comand Pallet Execute SFDX: Execute Anonymous Apex with Currently Selected TEXT

It does not work. I get the golowing error message: Unexpected token 'SELECT'.

Any idea?

thanksUser-added image

The data source fied is populated and the associated cross-object formula as well, however when debugging a test class,  it brings the cross-object formula value null.

Would be possible to read values from cross-object formula fields on a test class?

thanks

Dear Comunity, I hope all of you are safe and sound.

Is there any reason for cross-object formula returns null on apex test execution?

My test updated a field, then the System.debug shows the value from the cross-object formula, but it shows null even after querying it: 

That's the piece of the ciode:

 

Test.startTest();
                
        List<CC__c> cardlist = [SELECT Card_Id_CC__c,Card_Last_Modified_Date__c FROM CC__c WHERE Id = :e.Id];
        CC__c cardtest = cardlist[0];
        cardtest.Card_Id_CC__c = 'card12345'; 
        update cardtest;        
        System.debug(cardlist);
        System.debug('Card Last Modified date - CC__c.Card_Last_Modified_Date__c:  ' +cardtest.Card_Last_Modified_Date__c);
              
        
RG__c rglist2 =[Select Card_Last_Modified_Date__c FROM RG__c WHERE ID=:r.id];
        System.debug('This field must be equal to CC__c.Card_Last_Modified_Date__c '+ rglist2.Card_Last_Modified_Date__c);

 

Thank you all