Announcements
Hi All,
can someone explain the use of ForceLiterals, ForcePlaceholders keywords in AX.
When should we use these keywords?
Regards,
Nunna.
*This post is locked for comments
Hi Nunna,
In order to use these keywords, you should have a good understanding of SQL execution plans and option clause. There are many good blog posts which explains these concepts: here are some good reads.
https://fredshen.wordpress.com/2006/01/02/forceliterals-forceplaceholders/
http://www.databaseskill.com/675246/
We do not see extensive use of these keywords in AX. If you scan the AOT you might find only couple of instances where these keywords are used for example :
\Classes\ReleaseUpdateDB60_Ledger\updateTaxTransGeneralJournalAccountEntry()
\Data Dictionary\Tables\ReqTrans\Methods\bulkInitFromInventTransOrigin()
Unless you have a very good understanding of SQL server execution plans , leave it to the SQL server to select it's own plan as SQL server query optimizer may pick a plan that is targeting to return a few rows quickly, rather than a plan that will minimize the total result set retrieval.
Hope this help.
Please review following link for most comprehensive details
msdn.microsoft.com/.../aa656402.aspx
forceLiterals and forcePlaceholders are mutually exclusive.
please verify and update us if this helps you
As per MSDN documents you are not advised to use ForceLiterals keywords as it may expose code to an SQL Injection threat. It reveals physical values of where clause.
ForcePlaceholders hide physical values, moreover its default parameter.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
Thanks to all of our 2025 Community Spotlight stars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Liquid error: Object of type 'Adxstudio.Xrm.Web.Mvc.Liquid.EntityReferenceDrop' cannot be converted to type 'System.String'. Liquid error: Object of type 'System.Boolean' cannot be converted to type 'System.String'. Liquid error: Object of type 'System.Boolean' cannot be converted to type 'System.String'. Liquid error: Object of type 'System.Boolean' cannot be converted to type 'System.String'. Volodya 2
Liquid error: Object of type 'Adxstudio.Xrm.Web.Mvc.Liquid.EntityReferenceDrop' cannot be converted to type 'System.String'. Liquid error: Object of type 'System.Boolean' cannot be converted to type 'System.String'. Liquid error: Object of type 'System.Boolean' cannot be converted to type 'System.String'. Liquid error: Object of type 'System.Boolean' cannot be converted to type 'System.String'. tgudwanski 1