GETATTACHMENTS function

Created by Harry Lewis, Modified on Fri, 21 Mar at 7:46 AM by Grigorii Kosianenko

Applies to

  • Velixo NX 2025.02 or higher

  • Acumatica, CEGID, Haufe x360, JAMIS Prime, MYOB Acumatic

     

TABLE OF CONTENTS


Introduction

If you want to attach files to your report intended for distribution, use the GETATTACHMENTS function, which identifies the documents in Acumatica that will be attached to the report during the distribution.


During the PDF distribution process, the specified files will be downloaded, converted to PDF, and included in the resulting PDF file, saved to a destination folder, or attached to the email created by the distribution.


Syntax

=GETATTACHMENTS(ConnectionName, Object, KeyFields, FileNameFilter, Caption)

Parameters

Parameter

Required/Optional

Description

ConnectionName

Required

The name of the connection, as specified in the Connection Manager

Object

Required

Name of the entity as specified in the VEVelixoPackage endpoint in Acumatica.

It can be found in the Object Name field, on the Entity Properties tab, on the right pane of the Web Service Endpoints (SM207060) form, as shown in the screenshot below.

KeyFields

Required

A two-dimensional array containing key fields for the object and values for the key fields.

HSTACK({"CompanyID","ReferenceNbr"},VSTACK($N$9,$N$10))

The key fields allow Velixo to identify the specific document and get its attachments.
To prevent excessive files from being attached to the report, Velixo requires the specification of all key fields.


If you do not specify all key fields, the formula will return an error, and files will not be attached to the report.


See below the instructions on how to identify the key fields.

FileNameFilter

Optional

A filter specifies the names of the files to be downloaded. It may be a specific name ("invoice.jpg") or a wildcard ("invoice*") composed using the techniques described below.

Caption

Optional

A caption will be displayed at the top of the attached sheet when it appears in the resulting PDF file.


Output

Before distribution, the function returns the phrase ‘Attachment(s) will be processed during report distribution.
After distribution, the function indicates if the process was successful or not: either an error or the following phrase will be shown: ‘The processed attachments: <List of attachments>


How to define key fields

The process of entity key fields identification consists of several steps.

  1. Start with navigating to the relevant Acumatica screen. The ScreenId is available for each entity in the corresponding Entity Properties tab under the VEVelixoPackage endpoint on the Web Service Endpoints screen.


  1. Then, navigate to the screen and click on the DAC Schema Browser:


  1. The fields marked with yellow keys are the key fields, but it is not the end of the journey. Before using them in the formula, you should find their aliases for the endpoint.

  2. Find the Display Name values for the key fields in the DAC schema.



  1. On the Web Service Endpoint screen for a selected entity, open the Fields tab, and for all keys, find the Display Name values from the previous step in the Mapped Field column. 

  2. Finally, specify keys in the formula as shown in the Field Name column.



Filtering techniques

Symbol

Description

Example

Matches

*

Matches any number of any characters, including none

Invoice*

Invoice-241201.jpg
Invoice-c.jpg

?

Matches any single character

Invoice-2412??.jpg

Invoice-2412AB.jpg
Invoice-241299.jpg

[abc]

Matches one character given in the brackets

Invoice-[abc].jpg

Invoice-c.jpg

[a-z]

Matches one character from the locale-dependent range given in the brackets

Invoice-2412[0-2][0-9].jpg

Invoice-241201.jpg
Invoice-241218.jpg

Please consider file extensions when you compose your filter.


Example

Say you have a report for distribution containing a list of payments. You may want to attach the reasoning documents whose names contain the word Reason to each payment.

You can get the list of payments using the GI function with the generic inquiry for AR-Payments and Applications.

The following formula placed in the Attachments column of the table on the worksheet with the report will help you:

=GETATTACHMENTS("Acumatica", "Payment", VSTACK(HSTACK("DocType","Payment"),HSTACK("RefNbr",B2)), "*Reason*")

After calculation, you will see messages that attachments will be processed during report distribution.


After that, you need to set up the distribution process according to the guide and start distribution.


When the distribution list is prepared, you can run distribution, and then you will get your report with all existing attachments in the file  C:\temp\report.pdf.


The names of the processed files will be shown as the formula output.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article