Skip to main content Join the Agentforce Virtual Hackathon to build innovative solutions and compete for a $50k Grand Prize. Sign up now. Terms apply.

Hi  

I am getting Error : 

SOQL  currently not allowed 

 

My code is  :

 

SOQL  currently not allowed in apex

at line number 47 i am getting Error 

  

Error  : System.LimitException: SOQL currently not allowed 

 

please Help me  

Thank you 

 

 

#Trailhead Challenges #Salesforce Developer #Certifications #Security #Analytics

1 answer
  1. Eric Burté (DEVOTEAM) Forum Ambassador
    Mar 14, 2:33 PM

    Hello @ANJALI Anjali

    have you tried to do it in 2 steps, or with parenthesis.. 

    See the 2 options below & the associated log result :

    //Most common

    Organization oid = [Select Id, isSandbox from Organization Limit 1];

    Boolean isMyOrgASandbox = oid.isSandbox;

    System.debug(isMyOrgASandbox);

    //One line shorter

    Boolean isMyOrgASandboxBis = ([Select Id, isSandbox from Organization Limit 1])?.isSandbox;

    System.debug(isMyOrgASandboxBis);

    And the result in logHello have you tried to do it in 2 steps, or with parenthesis..Eric

0/9000