Comments
-
Hi All
We got the same requirement to edit the system fields,
When i googled found your post and it is very usefull.
but however your logic works till the execution(seen by debugging) only(records getting updated), once the execution is over those field values are changing back to the original values.
if any one knows how to prevent this
let me know.
thanks in advance.
Murali
-
You cannot update a system field once the record is been inserted in to table. You can only overwrite the values of system field at the time of insert only.
Search the text "overwriteSystemfields(true);" in AOT, you would find that all standard code available is at the insertion only.
-
Hi Anonymous,
Write your code in class and in the end add the below line
"CodeAccessPermission::revertAssert();"
and then set the class property "Run on -> Server".
Then call the particular method from the job or anywhere else. It will not throw any error like "Request for the permission of type 'OverwriteSystemfieldsPermission' failed".
-
Dear Sasha
i my code is below but do not updating created By
ttsbegin;
New OverwriteSystemFieldsPermission().assert();
pmsTable.overwriteSystemfields(true);
pmsTable.ManagerId = positionTable.ReportingPersonId();
pmsTable.ManagerName = positionTable.ReportingPersonName();
pmsTable.(fieldnum(pmsTable,createdBy)) = SysCompanyUserInfo::emplId2UserId(positionTable.ReportingPersonId());
pmsTable.doUpdate();
pmsTable.overwriteSystemfields(false);
//pmsTable.update();
ttscommit;
CodeAccessPermission::revertAssert();
-
I've tried this on the LedgerJournalTrans table but got the following error even if I assert permission, any idea what I've done wrong? Request for the permission of type 'OverwriteSystemfieldsPermission' failed. (S)\Classes\OverwriteSystemfieldsPermission\demand (S)\Classes\xRecord\overwriteSystemfields
-
Pessoal, Saiu uma publicação que achei interessante no blog do Sasha onde mostra como subrescrever um

Like
Report
*This post is locked for comments