Salesforce Fact #691 | Bind variable with date literals in SOQL

Bind variables cannot be used in SOQL with date literals like 'LAST_N_DAYS' in static context. So as a workaround, we can calculate the date value and then use the same in the SOQL.

Reference: https://salesforce.stackexchange.com/questions/7515/using-soql-apex-bind-variables-for-date-literals-e-g-last-n-days-today-this

Attached is the screenshot.



Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow