function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
developer_forcedeveloper_force 

expecting a right parentheses, found 'SELECT'

 

HI,

 

need help in this

 

List<QueryObjectPrimaryRefField__c > listTest = new List<QueryObjectPrimaryRefField__c>(SELECT QueryObjectField__c fromQueryObjectName__c where QueryObjectPrimaryRefField__c = :ApexPages.currentPage().getParameters().get('id'));


the error says "expecting a right parentheses, found 'SELECT' at line 34 column 88"

Baktash H.Baktash H.

I think its not possible to do all of that in one step.

Try this:

Id testId = ApexPages.currentPage().getParameters().get('id');
    List<QueryObjectPrimaryRefField__c > listTest = [SELECT QueryObjectField__c from QueryObjectName__c where QueryObjectPrimaryRefField__c = :testId];


developer_forcedeveloper_force

changed it but even its showing the same error

Baktash H.Baktash H.

try this:

Id testId = ApexPages.currentPage().getParameters().get('id');

 

List<QueryObjectPrimaryRefField__c > listTest = new List<QueryObjectPrimaryRefField__c >();

listTest = [SELECT QueryObjectField__c from QueryObjectName__c where QueryObjectPrimaryRefField__c = :testId];