We are migrating data from POS system to D365 for customers.
One of my requirement is, the created date in POS should be imported in D365 as well. So we need to over write the standard field created date in customer master.
1. I tried to create a runable class to check whether we are able to change the system fields and yes it is possible at the time of insertion and not during update. And it should run in server side
public static void main(Args _args)
{
CustTable CustTable
;
ttsbegin;
New OverwriteSystemFieldsPermission().assert();
CustTable.AccountNum = "1234";
CustTable.overwriteSystemfields(true);
CustTable.(fieldNum(CustTable, createdBy)) = "abs";
CustTable.(fieldNum(CustTable,createdDatetime)) = DateTimeUtil::newDateTime(today()-30, 0, DateTimeUtil::getCompanyTimeZone());
CustTable.insert();
ttscommit;
CodeAccessPermission::revertAssert();
}
2. Now in customer data entity level, I have created a virtual field to store the data from Source file to staging.
But now i am not getting, where to write code in entity level to change the system filed value of customer table.
I tried in event "CustCustomerV3Entity_onFindingEntityDataSource" but i couldn't get the data source of customer
Regards
Arun B S