AIF outbound XML

I’m still struggling with the AIF, but outbound this time.

I have followed the documenyt “Walkthrough for Creating a Service Using the AIF Document Service Wizard” on Ledger Journal and it works OK. However, I need to do it for statements, so have created a query on custtable and Custtrans then used the AIF Document Service Wizard. I followed the instructions to create CanXMLbeSent and SendElectronically. When I hit the new button on custatble form, I get an entry in the AIF Queue, but when I run the AIF services, I get an exceptions error :

No valid document identified from the entity key.

I googled this and found one possible cause, but I dont think it applies in my case.

I’ve tested the query btw and it returns the data I was expecting.

Can anyone help as I am totally flumuxed ( Not tremendously experienced in Axapta)

Have you checked the AIF exceptions to see if there is more details in there?

Please see this link:

The error appears in the exceptions list

I found that link through Google and it’s not the cause of the problem.

Thanks for the reponse though.


The issue more likely to do in the service itself. If you could send me details such as service class, document class, XML schema etc I could write a X++ job which you can then run and debug step by step.

Thanks I’m learning a lot trying to resolve this, but it’s taking up far too much time. I’ll no doubt learn a lot from your Job

Hi Harish,

Is there an example we could follow to create that job in X++ to test the service?

Ive been interested to look at that, but havent found any resources.

From what I have figured out, the AifMessage needs to be filled with the data being sent into the service, but thats where i get stuck at. A link to any think suggesting that would be great.


The error message is created by the module

public AifDocumentXml readDocumentList(AifConstraintListCollection _constraintListCollection)

and is thrown because _constraintListCollection.getConstraintListCount()== 0

I’m still flumuxed though. There are no constraints on the endpoint.

The FourOne Developer Link appears to be the exact cause of the problem. If I change the error messages, I can see that the error is thrown when in Classes/AxdBaseRead/serializeQuery a record based on the query is not found.

So no record is found by the query, but if I run the query directly from a Job, It finds a lot of records.


Though I downloaded your code, I have not got around to taking a look yet.

Regarding the latest issue, what action (create or find) are you calling? If create, try troubleshooting in prepareForSave method in your class which extends ‘AxdBase’ framework.

If you are calling find, you can override your above class and create ‘prepareForQuery’ method. Here you will have the ability to override your actual query and pack/unpack values on the actual query.

I tried it on the Dynamics AX 2009 Retail VPC I recently downloaded and guess what - It worked! I followed exactly the same walkthrough, so there must be something wrong with the data on the original VPC. I’ll try reindexing it. Otherwise, I’ll transfer my stuff to the new VPC.

Downloaded the current VPC refress 3.5 and The wizard works. Sorry folks, there must have been some corruption in my data.

Downloaded the current VPC refress 3.5 and The wizard works. Sorry folks, there must have been some corruption in my data.