Friday, July 2, 2010

Overwrite System Field in a Table

The code below work ony at Server Side !


 
Static Server void Run()
{
    CustTable   custTable;
    ;


    ttsbegin;

    new OverwriteSystemFieldsPermission().assert();

    custTable.clear();
    custTable.AccountNum = "TEST";
    custTable.overwriteSystemfields(true);
    custTable.(fieldNum(custTable, CreatedDateTime)) = DateTimeUtil::newDateTime(01\11\2013,0);
    custTable.insert();
    
    CodeAccessPermission::revertAssert();
   
    ttscommit;
}



Enjoy !

1 comment:

Unknown said...

Hi Denis

This code very useful.
but the changes in scope till the execution cycle only.
Once the job/class is executed the system field data is changing back to as old.
we are trying to edit the createddatetime field.