How Do I Post SalesInvoice (FormLetter) to Lasernet Destinations from Code?
    • 21 Mar 2024
    • 1 Minute to read
    • Contributors
    • PDF

    How Do I Post SalesInvoice (FormLetter) to Lasernet Destinations from Code?

    • PDF

    Article summary

    This article provides a code sample for posting SalesInvoice (FormLetter) to Lasernet Destinations from code.

    In general, it does not matter which report the code is applied to. Our sample is based on the SalesInvoice.ReportResolution.

    staticvoidLAC_SalesInvoiceUpdate(Args _args)
    
    {
    
     SalesFormLetter salesFormLetter;
    
     SalesTable salesTable;
    
     SRSPrintDestinationSettings printSettings;
    
     LACDestinationSettings LACDestinationSettings =newLACDestinationSettings();
    
     ;
    
     salesTable = SalesTable::find("000740");
    
     salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
    
     SalesFormLetter.getLast();
    
     
    
     printSettings =newSRSPrintDestinationSettings();
    
     printSettings.printMediumType(SRSPrintMediumType::LAC);
    
     
    
    /* use the following if the destination should be Fax -->
    
     LACDestinationSettings.destTypes4Print(LACDestTypes4Print::Fax);
    
     LACDestinationSettings.fax('fax number');
    
     <-- Fax */
    
     
    
    /* use the following if the destination should be Custom port -->
    
     LACDestinationSettings.destTypes4Print(LACDestTypes4Print::CustomPort);
    
     LACDestinationSettings.customPort('value for customport');
    
     <-- Custom port */
    
     
    
    /* use the following if the destination should be Email --> */
    
     LACDestinationSettings.destTypes4Print(LACDestTypes4Print::Email);
    
     LACDestinationSettings.emailTo('The emailaddress');
    
     LACDestinationSettings.emailBcc('Bcc emailaddress');
    
     LACDestinationSettings.emailSubject('Text for email subject');
    
     LACDestinationSettings.emailBody('Text for Email body');
    
     LACDestinationSettings.emailFrom('From emailaddress');
    
     LACDestinationSettings.emailFromName('From email name');
    
    /* <-- Email destination */
    
     
    
    /* use the following if the destination should be Printer -->
    
     LACDestinationSettings.destTypes4Print(LACDestTypes4Print::Printer);
    
     LACDestinationSettings.printer('LaserNet Printername');
    
     LACDestinationSettings.printerProfile('LaserNet Printer profile');
    
     <-- Printer */
    
     
    
    /* use the following if the predefined destinations should be used with fallback -->
    
     LACDestinationSettings.destTypes4Print(LACDestTypes4Print::UsePredefinedDest);
    
     LACDestinationSettings.defaultDestTypes4Print(LACDestTypes4DefaultPrint::Printer); // Fallback destination type
    
     LACDestinationSettings.printer('Fallback printername');
    
     LACDestinationSettings.printerProfile('Fallback Printer profile');
    
     <-- Predefined destinations */
    
     
    
    /* The following control the docu-attachment type and restriction -->
    
     LACDestinationSettings.docuType();
    
     LACDestinationSettings.docuRestriction();
    
     <-- Docu-attachment and restriction */
    
     
    
    /* The following control which overlayId to use -->
    
     LACDestinationSettings.overlayId();
    
     LACDestinationSettings.forceReRun(NoYes::Yes);
    
     <-- Overlay (watermark) */
    
     
    
     printSettings.lacDestinationSettings(LACDestinationSettings);
    
     
    
     if (salesTable)
    
     {
    
     salesFormLetter.updatePrinterSettingsFormLetter(PrintSettings.pack());
    
     salesFormLetter.update(salesTable,
    
    SystemDateGet(),
    
     SalesUpdate::All,
    
     AccountOrder::None,
    
     NoYes::Yes,
    
     NoYes::Yes);
    
     }
    
     
    
    }


    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.