You need to sign in to do that
Don't have an account?
Timmy Ahluwalia
casting
Hi
i have created the dynamic query where I have the record id, using the schema i have built the database.query, i am unable to get the values out of this query,
if(dfr.isNameField()){
query = 'SELECT Id, ' +dfr.getName()+ ' FROM ' +myobj+ ' WHERE Id =:myId';
}
list<sobject> query = database.query(query);
for(sobject s: query){
// want ot extract he value of the Name
}
can not do the casting.
Help to solve this.
Thanks
i have created the dynamic query where I have the record id, using the schema i have built the database.query, i am unable to get the values out of this query,
if(dfr.isNameField()){
query = 'SELECT Id, ' +dfr.getName()+ ' FROM ' +myobj+ ' WHERE Id =:myId';
}
list<sobject> query = database.query(query);
for(sobject s: query){
// want ot extract he value of the Name
}
can not do the casting.
Help to solve this.
Thanks
If your function is exposed in the UI, I highly recommend sanitizing it using escapeSingleQuotes method to defend against SOQL Injections. Also it is advised to rename the list query to something more meaningful like results.