How to use String.escapeSinglequotes for the below syntax.
Id clientId = (id)inputMap.get('ClientId')
I used like this:
Id clientId = String.escapeSinglequotes((id)inputMap.get('ClientId'));
Account a= [Select Id, Client__c, ParentId, Parent.RecordType.DeveloperName,CI_ClientID__c
from Account where Id = :clientId limit 1000]
but its not working.
error is : Method invokeMethod gets user input from element inputmap. This input is later concatenated by the application directly into a string variable containing SQL commands, without being validated. This string is then used in method to query the database select, at line 55 without any additional filtering by the database. This could allow the user to tamper with the filter parameter.
Idtype cannot have single (or double) quotes, only alphanumeric characters, so even if it worked, it would be useless. It seems an XY problem. Could you please tell us why you're trying to escape single quotes from an Id? Providing the actual code without altering it, as well as the error message verbatim (if any) would help. – RubenDG Aug 17 '23 at 13:15