You need to sign in to do that
Don't have an account?
ramya1
unexpected token: 'Project__c'
hi,
Am trying to make the class dynamic..am getting error at parentQuery...getting unexpected token: 'Project__c' in which
Project__c is parent name in the query...
string parentQuery = 'SELECT Id FROM ' + parentName + ' where id=\'' + parentID + '\'';
SObject ParentObject = Database.query(parentQuery)[0];
thanks in advance...
Change the query like string parentQuery = 'SELECT Id FROM ' + parentName + ' where id=: parentID ';
and try..
I even tried it...but getting the same issue
I tried to execute your query in developer console and it seems to be working fine for me...
I tried the below code..
String parentName = 'Employee__c';
String parentID = 'a00D000000IzFdh';
string parentQuery = 'SELECT Id FROM ' + parentName + ' where id=\'' + parentID + '\'';
SObject ParentObject = Database.query(parentQuery)[0];
System.debug('ParentObject='+ParentObject);