Hi,
I have a working NAV2015 solution that I have just upgraded to NAV 2016. In that solution, when the Sales Order list opens from the Role Centre there are some extra columns that involve calling code units to calculate some extra information about Group credit limits etc.
In those code units I use temporary Customer tables to do calculations. The first thing I execute is a DELETEALL statement on the temporary table.
This has worked fine in all versions from Classic to NAV2015.
In NAV2016 the page fails with a message "A transaction must be started before changes can be made to the database." Looking at the code, the sequence is as follows:
TempCust.DELETEALL
now seems to trigger new functions in Codeunit 1550 Record Restriction Management
RemoveCustomerRestrictionsBeforeDelete(VAR Rec : Record Customer;RunTrigger : Boolean)
AllowRecordUsage(Rec.RECORDID);
and then
AllowRecordUsage(RecID : RecordID)
RestrictedRecord.SETRANGE("Record ID",RecID);
RestrictedRecord.DELETEALL(TRUE);
which is where the debugger falls over with the message.
This only happens opening the page from the Role Centre. If I go to another route and open the Sales Order page from a Factbox for example it works fine.
As I said, this code has worked perfectly over the last 4/5 versions.
Anybody experienced this with NAV2106 yet?
0
Comments
In a Cronus Database in NAV2016, insert the following code in the OnAfterGetNextRecord of Page 9305
//debug
Cust.GET("Sell-to Customer No.");
TempCust := Cust;
TempCust.INSERT;
TempCust.DELETEALL;
//debug
I know the code does not make sense but it illustrates the issue.
If you run the page from the development environment then you get the error mentioned above.
Anybody think this is a bug? I've even tried it on the CU1 release and no change.
In Code Unit 1535 - Function DeleteApprovalEntriesAfterDeleteCustomer add a line:
IF Rec.ISTEMPORARY THEN EXIT;
In Code Unit 1535 - Function DeleteApprovalCommentsAfterDeleteCustomer add a line:
IF Rec.ISTEMPORARY THEN EXIT;
In Code Unit 1550 - Function RemoveCustomerRestrictionsBeforeDelete add a line:
IF Rec.ISTEMPORARY THEN EXIT;
This is a very specific solution to my issue and I think there is a more fundamental problem underlying this new functionality - hopefully someone from Microsoft might be reading this?