I Have a dataport to import Internet Orders. Everything works great but the Dataport STOPS on blocked items. So I added;
OnAfterImportRecord=BEGIN
Item.GET("Sales Line"."No.");
IF Item.Blocked THEN
"Sales Line"."No." := '99904';
Works Fine Item # 99904 is a Miscellaneous Blank Item Not used for anything.
What I would like to do is if an item that is being imported IS blocked then Switch the item# to 99904 BUT place the item # that was REPLACED into a field called "EDI Cross Reference Field" (it also type code) so I know what it was.
My problem is with the switch to 99904 the old item info is gone. any ideas.
Answers
The dataports dataitem shouldn't "sales Line". You cannot control the sequence of validation, which is you case. You need to assign the fields to an array. use Interger table as dummy dataitem. Onafterimportrecord add you code. and do the validation from the array of text.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
If Item.BLOCKED THEN
MESSAGE(Text0002,"Sales Line."No.","Sales Line"."Document No.");
Where Text0002 is
"Item %1 is Blocked on Order %2"
Now it tells me. I really didn't want this dataport to become overly complicated.
http://www.BiloBeauty.com
http://www.autismspeaks.org
For simple tables where there is no validation you can use the dataitems. Form complicated ones dataports are not enough.
I just never used dataitems for complicated dataports, Such as creating sales order. I use Dummy interger dataitem and asign the values to an array. and onafterimportrecord put my code.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Of course that it is gone, you need to save it somewhere:
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
So I created another Variable:Internet_Cust_Orig_Item & It works
I set it before anything happens & bring it back later
OnAfterImportRecord()
http://www.BiloBeauty.com
http://www.autismspeaks.org