0
queryString = 'Select id,'+string.join(new List<string>(tempset), ',')+' from '+relatedObject+' Where '+referenceFieldApiNameFromPage+'=\''+(Id)sobjectIdFromPage+ ' order by LastModifiedDate DESC '+ '\'  limit 10000';

Show Record in order by LastModifiedDate DESC but its throw

invalid ID field: 00128000003MKtxAAG order by LastModifiedDate DESC

2

Try below code. It seems you are missing ' mark and at the end you have unwanted ' mark.

queryString = 'Select id,'+string.join(new List<string>(tempset), ',')+' from '+relatedObject+' Where '+referenceFieldApiNameFromPage+'=\''+(Id)sobjectIdFromPage+ '\' order by LastModifiedDate DESC '+ '  limit 10000';
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.