Request for the permission of type ‘OverwriteSystemfieldsPermission’ failed.
(S)\Classes\OverwriteSystemfieldsPermission\demand
(S)\Classes\xRecord\overwriteSystemfields
It is not possible to directly update the system fields. But there is an alternate way you can do it.
Do an update directly in the Database or execute a direct SQL statement by using Statement(API) class.
Note: Dont do it in case of the transaction tables and even in case of master tables if the trasactions exists for that - which may lead to data inconsistency…
I will try to do updation in SQL.But they have given a method overwritesystemfields() ,so i thought why it is not possible to do in AX itself?May be i would need some permission,But it dint work ,giving whatever kind of permissions
I tested this already, it works. You most likely still have it running client side. It must run server-side in order for the permission assertion to work. Create a class, Class1, then add your code inside a method called “static server void myMethod()”. Then from a job, call “Class1::myMethod()”. This will ensure it runs server side. It will only work for INSERTS and not updates.
Narayan,
The purpose is for database logging, importing data from other systems, etc. Take for example you have a 3rd party CRM system (i.e. SalesForce.com) that your users enter sales orders into. At the end of the night, you have a batch job in AX that imports all of the sales orders into your system. All of the sales orders will have a “CreatedBy” of your AOS user account, and not the actual users that created each sales order. This is an example of where you would overwrite system fields, and change the “CreatedBy” to the user that created the sales order, instead of the system account that’s importing the sales orders.