Automatically save a document using "Send-to program" as blo

kbjernokbjerno Member Posts: 6
Is it possible some how to use the function Send-to program and in same loop fetch the file and save it into NAV?
On both Classic and RTC
(Using NAV ver 9 SP1)

Comments

  • northernernortherner Member Posts: 67
    You need to modify codeunit 403 "Application Launch Management", which controls the document creation. You need to add code to the LaunchApp function to make the ApplicationXML (automation server of type 'Microsoft XML, v6.0'.DOMDocument60) save the file to disk. Since you control the file name / location, you can then add code to make use of it (e.g. attach it to an email, etc). Here is an example:
    AppStylesheet.SETRANGE("Style Sheet ID",StylesheetID);
    IF NOT AppStylesheet.FIND('-') THEN
      EXIT(FALSE);
    
    AppStylesheet.CALCFIELDS("Style Sheet");
    AppStylesheet."Style Sheet".CREATEINSTREAM(InStream);
    CREATE(StylesheetXML);
    StylesheetXML.load(InStream);
    
    EVALUATE(id,GetAttributeValue(DataXML,'Object','id'));
    CASE id OF
      FORM::"Customer Card": AddCustomerLetter(DataXML);
      FORM::"Vendor Card": AddVendorLetter(DataXML);
      FORM::"Contact Card": AddContactLetter(DataXML);
      FORM::"Sales Quote": AddSalesQuote(DataXML);
      FORM::"Sales Order": AddSalesOrder(DataXML);
    END;
    AddLocaleInfo(DataXML);
    
    DataXML.transformNodeToObject(StylesheetXML,ApplicationXML);
    
    //some code here to determine the file name and location - I've hard coded below for this example
    
    ApplicationXML.save('c:\test\app.xml');
    
    //some code here to do something with the file
    
    EXIT(TRUE);
    
  • kbjernokbjerno Member Posts: 6
    Tried that and that works in classic client but not til RTC - and that is, of course, what I need :(
    Any other good ideas?
Sign In or Register to comment.