Equisys Technical Notes

Technical guidance, explanations and fixes for our products

HOWTO Add Save & Send functionality to any single record report

Print

ZTN4190

ID: ZTN4190

This Zetadocs technical note applies to:

  • Zetadocs Express

Summary

This technote will provide guidance on adding the Zetadocs Express Save and Send functionality to any single record report.

More Information

Prerequisites

  • The factbox and the Save and Send button need to have been added to the desired page, please see your Zetadocs Express install materials for further information.

Save & Send Integration code unit

  • From the Microsoft Dynamics NAV Classic Client, open the Object Designer (SHIFT + F12).
  • Locate the following code unit:  9041223 Zetadocs-Save & Send Integration and select Design.

Save Custom PDF Report:

This function is intended to save a copy of the desired report in the 'TEMPORARYPATH' location and returns the full name of the report (including the extension). The logic to save the report, for a desired record, needs to know which table the record is based upon.

 
To implement this, we need to do the following:

  • Declare a Record variable based on the relevant table.   
  • To do this browse to View > C/AL Locals > Variables and add a new variable.

                        Name:               < RelevantRecordVariable>
                        DataType:         Record
                        Subtype:           < The table the record is based from>

  • In the first CASE statement, set a relevant report name (including extension) depending on the report number in the FileName variable:

                        ...
            CASE ReportID OF
            ...

              < ReportNumber> :
              BEGIN
                FileName := " < Relevant Report Name> " ;
              END;

            ...

  • Implement in the CASE statement below the following set of instructions depending on the            table number and with a relevant report name:

Note - If an error in processing occurs, the function should return an empty character ('').

...
CASE RecordID.TABLENO OF
...

  < RelevantTableNumber> :
  BEGIN
    FileName := " < ReportNameVariable> " ;
    FilePath := TEMPORARYPATH + FileName;
    RecRef.SETTABLE(< RelevantRecordVariable> );
    < RelevantRecordVariable> .SETRECFILTER;
    IF (REPORT.SAVEASPDF(ReportID, FilePath, < RelevantRecordVariable> )) THEN
      BEGIN
        EXIT(FileName);
      END;
    END;
...

  • Save and Compile once you have completed your changes.

Configure auto addressing for the Send feature

The function named GetCustomEmailAddress is the one to be used to configure auto addressing for the Send feature. The logic to get the contact email address for a given record requires you to:

  • Know from which table the relevant record is based.
  • Identify which field in this table contains the required contact information.

To implement his, do the following:

  • Declare a Record variable based on the relevant table.   
  • To do this browse to View > C/AL Locals > Variables and add a new variable.

            Name:               < RelevantRecordVariable>
            DataType:         Record
            Subtype:           < The table the record is based from>

  • Implement in the following CASE statement instructions filled with the relevant information:

...
CASE RecRef.NUMBER OF
...

  < RelevantTableNumber> :
  BEGIN
    RecRef.SETTABLE(< RelevantRecordVariable> );
    IF ContactNumber.GET(RecRef.FIELD(< RelevantFieldNumber> )) THEN
    BEGIN

      EXIT(ContactNumber.”E-Mail”);
    END;   
  END;
...

  • Save and Compile once you have completed your changes.
  • This should complete the setup of Save and Send functionality for the selected report.

References

Last updated: 30th April 2012 (SD/MW/) 

EquisysLogo

Recent news

As part of our drive towards making the software simpler to use, Zetadocs Expenses now supports single sign-on using Microsoft work or school accounts. This makes it easier for Office 365 ...

This article describes the new features and other improvements in the August 2019 release of the Zetadocs Expenses service. Zetadocs Expenses ...