Jun 03 2008

How to save XML triggered by an event

Published by rollo at 3:14 pm under Uncategorized

If you are using Business Notifications for Dynamics NAV and would like to see how does the xmlport output look like after an event is triggered, this is a post for you…
In this example “Inventory Status” event is taken into consideration, but you can use it for any other event. In order to be able to save an xml content generated by an xmlport, replace a piece of code related to “Inventory Status” event in codeunit 8000 Business Notification Mgt. with the following:
 
        REPORT::”Inventory Status”: BEGIN
          RecRef.SETTABLE(Item);
          Item.SETRECFILTER;
          ItemXML.SETTABLEVIEW(Item);
          tempBLOB.Blob.CREATEOUTSTREAM(outStream);

         ItemXML.SETDESTINATION(outStream);
          ItemXML.EXPORT;

          F.CREATE(’c:\output.xml’);
          F.CREATEOUTSTREAM(tempOutS);
          tempBLOB.CALCFIELDS(tempBLOB.Blob);
          tempBLOB.Blob.CREATEINSTREAM(tempIns);
          COPYSTREAM(tempOutS, tempIns);
          F.CLOSE();
          ItemXML.”Inventory Status”;
          LineSent := TRUE;
        END;
and just trigger an event the usual way.

/rollo

Trackback URI | Comments RSS

Leave a Reply

*
To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word