You need to sign in to do that
Don't have an account?
JohnDurai
custom label in SOQL as Parmater Error
Hi - I am trying to user below query in batch class querylocator, I want to change the lastmodified date from configuration level without touching code. So, I am using custom label and my custom label input field as number and i am passing it in query, but getting error can someone suggest how to fix?
return Database.getQueryLocator([SELECT Id, Status,RecordTypeId, Resolution_Status__c, LastModifiedDate FROM CampaignMember where RecordTypeId ='0120p000000Fy09AAC' AND (Resolution_Status__c ='Resolved' OR Resolution_Status__c ='Closed') AND LastModifiedDate < LAST_N_DAYS:Integer.valueOf(system.Label.LastmodifiedDateforCM)]);
Error: Missing 'INTEGER_LITERAL' at 'Integer.valueOf'
Extra 'IDENTIFIER', at '('.
expecting a number, found 'Integer.valueOf'
return Database.getQueryLocator([SELECT Id, Status,RecordTypeId, Resolution_Status__c, LastModifiedDate FROM CampaignMember where RecordTypeId ='0120p000000Fy09AAC' AND (Resolution_Status__c ='Resolved' OR Resolution_Status__c ='Closed') AND LastModifiedDate < LAST_N_DAYS:Integer.valueOf(system.Label.LastmodifiedDateforCM)]);
Error: Missing 'INTEGER_LITERAL' at 'Integer.valueOf'
Extra 'IDENTIFIER', at '('.
expecting a number, found 'Integer.valueOf'
try with below query.
Refer the below link.
https://stackoverflow.com/questions/70631498/custom-label-value-not-working-in-soql-query
If this helps, Please mark it as best answer.
Thanks!!