AX Sandbox - Demo Data issue

Hi Guys!

We have done a fresh install of AX 2012 R3 CU8 and imported the Demo Data for R3 CU8.

X++ & CIL Compile done and DB Sync also done

Whenever we try to create and save/confirm a new PO we are getting the below error:

Cannot create a record in Purchase order lines (PurchLine). Purchase order: XXXXX, 1000. The record already exists.

The weird thing is this is not affecting the Open POs imported with Demo Data. Those can be saved and confirmed and completely processed till Invoicing.

Error comes up only when new PO is created. New PO # is generated but, can’t save/confirm after adding an item in it.

Please help!

It seems you have a problem with number sequence, e.g. for SalesLine.InventTransId. How did you import the data? Did you generate and use metadata.xml? Did the data import end without any error?

If you do all right and it still doesn’t work, you could identify the problematic number sequence and modify it. Nevertheless who knows how many other problems you have there…

Data was imported using Test Data Transfer tool. It was imported using the commands specified in Technet. There were a couple of errors. But, we got them while creating similar instances before as well but, didn’t hamper any functionality.

Technet doesn’t specify anything about metadata.xml. Is it mandatory to generate it from somewhere?

We tried creating a new number sequence and attached it to the PO but, still the same.

Also, we are having issues with the Purchase order not sales order.

Loading the metadata is definitely worth trying, especially if somebody below the article complain about missing steps. Look here for instructions.

Ignoring errors doesn’t sound like a very wise approach. Nevertheless I can’t comment on your specific errors because I don’t know what errors you got.

Regarding changing number sequences, you would first have to identify what number sequence is to blame. Changing just some number sequence won’t help.

Thanks Martin for the quick response!

Since, I’ve already imported the demo data - is there a way re-import everything or do I have to start from scratch [i.e., uninstalling AX and re-install and then re-import the data].

Purchase order is getting created but, getting error to create Purchase order lines. Which other number sequences could be at play here?

Just run it again, it will overwrite existing data.

It may be caused by any unique index in the table - TransIdIdx, SourceDocumentLine, RecId… You would check the values before saving and compare them with what’s already in database; that would tell you which field is to blame. But I wouldn’t bother unless everything else fails.

Generated the XML and now importing the data again.

Do I need to do a DB Sync after import of demo data?

Importing data doesn’t change database schema, therefore you don’t really need to synchronize DB schema with your application. It might detect issues with duplicate values, but there shouldn’t be any if you have AX without customizations and matching demo data.

Import completed - 7 Tables had errors. I saw the log most of which are for Retail tables.

However, the error still persists. Do I need to do X++ & CIL compile?

This is a plain vanilla box - no customizations Sandbox.

Please see error below:


No, you don’t have to recompile code if you didn’t change it.

OK thanks! Any idea on what else could be wrong?

Sales orders are getting posted. Existing purchase orders [the default contoso ones] which are in “Open order” state can be confirmed and processed further.

However, when I create new PO - it gets created but, when I add new line - I am not able to save that line and am getting the error as above and that too not just in USMF but other legal entities shipped with Contoso as well.

Identify the unique index and particular field(s) causing the problem. When you know what’s wrong, we can discuss how to fix it.

Our technicals after debugging the issue say it’s mostly a data issue. We’ve created an environment with a fresh instance of AX 2012 R3 CU8 sans the demo data. We’ll see if the issue affects this instance.

Sure, the whole issue is all about data. That’s nothing new.

OK. Created a test company on a clean instance and PO got posted. No errors.

Re-created the Sandbox environment and Contoso demo data is also loaded and functioning! Didn’t know what went wrong!

Anyways, Thanks for the help extended Martin!