Automatic email notifications

 

In ERPLY Books, it is also possible to set up automatic notifications that are sent to specified email addresses. Examples of cases in which this may be necessary:

  • You would like to email a sales by customers report once a month to the company’s manager.
  • You want to receive a specific notification (for example, receive an email if the sales invoice you made exceeds the deadline by 3 days or, for example, receive a reminder if you have not confirmed the invoice within three days after receiving the request)

To set this up, write “Manage notifications” in the search field on the main page, and then the following will open:

 

 

Setting up columns

 

Now the following rules must be added:

  • JSON: {“tables”:”DOCUMENT”,”output”:”DOCUMENT.DATETIME|DOCUMENT.NUMBER|DOCUMENT.SUM_NO_VAT”,”groupBy”:””,”parameters”:[{“rules”:[{“tableName “:”DOCUMENT”,”fieldName”:”CREATE_DATETIME”,”referenceType”:”MORE_THAN”,”value”:”2022-09-30T21:00:00.000Z”,”filterName“:”first”}],” index”:0}]}
  • Body: Must be written as HTML, described below
  • Email: where the notification is sent
  • Subject: the email’s subject
  • Show in groups: setting this up is necessary if you want the sent emails to be different and grouped by a certain characteristic

For example, if you want to send an email to all vendors, then all vendors are searched for at the same time. If you determined with a rule that the groupValue is the registration code, then the email is sent to all vendors separately.

  • Sum: You can add an amount that will be added to the end of the email
  • Add filter: for example first=DATE_MINUS3 (explanation below)

Finally, save the changes, log out of the account and back in for the changes to apply.

Setting Up Reports Directly via PDF URL

You can set up reports using the PDF URL of the desired report.

  1. Adding the URL: The PDF URL must be added instead of JSON. For example:
    https://a2.erplybooks.com/service/organisations/{organisation_id}/export/ar/balanceSheet?printWithAccounts=true&removeZeroValues=true&getSummary=false&comparativeDateFrom=2023-01-01T23%3A59%3A59&comparativeDateTo=2023-12-31T23%3A59%3A59&dateFrom=LAST_MONTH_BEGINNING&dateTo=LAST_MONTH_END&useHtml=false&lang=LANGUAGE_ET

    Replace {organisation_id} with your organization ID and select appropriate dates as described below.

  2. Setting Dates: The URL must specify date values. For example:
    • LAST_MONTH_BEGINNING: beginning of the previous month
    • LAST_MONTH_END: end of the previous month

    You can choose from the following values:

    • LAST_YEAR_BEGINNING
    • LAST_YEAR_QUARTER_BEGINNING
    • THIS_QUARTER_BEGINNING
    • THIS_YEAR_BEGINNING
    • LAST_MONTH_BEGINNING
    • THIS_MONTH_BEGINNING
    • LAST_YEAR_END
    • LAST_YEAR_QUARTER_END
    • THIS_QUARTER_END
    • THIS_YEAR_END
    • LAST_MONTH_END
    • THIS_MONTH_END
  3. Email Setup: For example, if you want to send a report to the company manager on the 25th of each month, whose email address is specified, set the reporting period to the beginning and end of the previous month.
  4. Sending Multiple Reports: If multiple reports are generated on the 25th, where the email subject and recipient are the same, all files will be sent in a single email.

Describing HTML

 

HTML consists of different parts that are joined together later. | is used as a delimiter.

In general, the HTML would look something like this:

Add introductory text here|FIRST:ENTITY.BILLING_NAME|<table style=”border:1px solid black;width:100%;border-collapse:collapse”><tbody><tr><th>Department</th><th >Article</th><th>Quantity</th></tr>|ALL:PROJECT.NAME,ARTICLE.NAME,ARTICLE_ROW.QUANTITY|</tbody></table>|SUM:Total:|End of email here

 

HTML parts

 

Let’s describe the parts of the HTML:

  • FIRST:BooksContactName – retrieves BooksContactName from the first object on the list.

For example, you are sending quantity comparison balances to vendors and you want to enter the vendor’s name: <table style=”border:1px solid black;width:100%;border-collapse: collapse”><tbody><tr><th>Column 1 Name</th ><th>Column 2 name</th><th>Column 3 name</th></tr> – this is the table style and headers.

  • ALL:BooksWarehouse,categoryName,purchasedQuantity – ALL means that all rows will be added in the table

As a style, add the usual <td style=”text-align:right;border:1px solid black;border-collapse: collapse”>

</tbody></table> – this is the end of the table

  • SUM:Total: – if you have set a summing value, after the value of “SUM:” the system will add what is written there and the number summed accordingly, the given amount is not rounded. For example, if the amount was 2482.00, the value will be “Total: 2482.00”.

As a more specific example, here is the HTML description in case you want to send a table to a customer. Below you can see the sales documents’ numbers, dates and amounts.

The HTML should be composed as follows:

Hello!<br><br>We are sending new documents. |<br><br><table style=”border:1px solid black;width:100%;border-collapse: collapse”><tbody><tr><th>Nr</th><th>Kp</ th><th>Sum</th></tr>|ALL:DOCUMENT.NUMBER,DOCUMENT.DATETIME,DOCUMENT.SUM_NO_VAT|</tbody></table>|<br><br>Have a nice day, < br><br>Your partner

In an email it would look like this:

Hello

We are sending new documents.

Document  numberDateAmount

Total: 8482.00

We wish you a nice day,

Your partner

 

How to set up the “Add filter” column?

 

Since the content of the email and the table are created based on the filters that are set up in the Report Generator, the filters which the system needs to change must be set to filterName according to the rules. Through this, the system will know which filter to change.

Let’s say you want to search for new contracts. In this case, there need to be at least two filters in the Report Generator:

  1. Type = contract
  2. Creation date = later than or equal to today’s date.

Here, don’t change the Type filter, but the date in the system needs to be set for today.

Filters that can be changed:

MONTH, YEAR and DAY are for indices where the value is month, year or day:

  • DATE – for those where there is a date change
  • CURRENT_MONTH, CURRENT_YEAR and CURRENT_DAY – values ​​without plus and minus signs

The rest work on the principle that you write a number at the end (for example, how many days/months/years back/forward you want to go)

Examples:

  • DATE_MINUS10 – takes a date that was 10 days ago
  • DAY_PLUS7 takes the day a week later

Exception:

  • If CURRENT_YEAR and MONTH_MINUS are specified and the month is 12, the year is taken as -1 because MONTH_MINUS says to go back some months. So when December of the previous year came up, the year must also change.
  • Similarly, if there are CURRENT_YEAR and MONTH_PLUS and the value of the month becomes +1, then the year changes accordingly.