It throws exception when i try to validate dimension on sales invoice line using xmlport..
if i dont validate it, it works fine but den dimension doesnt it cos sales g/l entries...
any idea?
---------------------------
Microsoft Dynamics NAV Classic
---------------------------
The Sales Line does not exist.
Identification fields and values:
Document Type='Invoice',Document No.='620337',Line No.='20000'
---------------------------
OK
---------------------------
This is one of the main issues when using Nav for integration.
Many tables, the way the code is written expects that the user is entering the data. So based on that fact if you are inserting the data through code, you have to take care of all the code that works fine for a user but doesn't work when doing it through code.
In your scenario. A user would insert the invoice line first, and then select a dimension.
On an XMLPort. the validate occurs first then the record is inserted.
What are you options? Don't trigger the code, and on insert add your own code and insert the record first and then fire the validation sequence.
The whole dimension implementation is horrible anyways.
They should have left Department and Project fields as is and have dimension as new functionality, nothing to do with Department/Project. No stinking synch code.
They could have added 8 more dimension fields to all the tables and call it 10 dimension, if any company needed more, they could do a modification.
They could have removed the department/project from the table and just keep it in dimension table.
I am using this: when importing through XMLPort, I set the source table (the xml element of type table) as temporary and I am processing the data from this table in OnPostXMLPort where I am inserting the data into real tables in a way like when user enters them - it means:
<Fill primary key>
INSERT(True);
<validate other fields>
MODIFY(True);
Because in this way the dimensions will be filled in correctly...
Answers
Many tables, the way the code is written expects that the user is entering the data. So based on that fact if you are inserting the data through code, you have to take care of all the code that works fine for a user but doesn't work when doing it through code.
In your scenario. A user would insert the invoice line first, and then select a dimension.
On an XMLPort. the validate occurs first then the record is inserted.
What are you options? Don't trigger the code, and on insert add your own code and insert the record first and then fire the validation sequence.
The whole dimension implementation is horrible anyways.
They should have left Department and Project fields as is and have dimension as new functionality, nothing to do with Department/Project. No stinking synch code.
They could have added 8 more dimension fields to all the tables and call it 10 dimension, if any company needed more, they could do a modification.
They could have removed the department/project from the table and just keep it in dimension table.
<Fill primary key>
INSERT(True);
<validate other fields>
MODIFY(True);
Because in this way the dimensions will be filled in correctly...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
thanks for your help.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!