A request i sometimes see from customers upgrading from NPrinting v16 is the ability to send multiple emails to the same user for the same NPrinting Publish Task.
We can use a 'cycle' to send different filtered copies of the same report in the same email, but sometimes we want those filtered reports to be split by email.
Also, sometimes its not just for one user but a combination of users.
Basically we want to send out the same report filtered different ways for different people in different emails....
The solution in v17+ is to use the API for this request and we can use the Qlik REST Connector inside the load script of a QlikView QVW or a Qlik Sense app to sequentially run the task changing the recipients and filters with each task execution. By changing the recipients and their filters with each task execution, the recipients receive the reports in the task in different emails.
For reference, see the following resource on how to setup a Qlik load script to communicate with the NPrinting API
In the attached sample you will find the following approach
1. Pre-create the Publish Task in NPrinting with the required report(s) and distribute the task to an NPrinting group
Pre-create the intended recipients in NPrinting but do not assign the recipients to the NPrinting group.
It is possible to create the Users dynamically for a more dynamic solution.
It is NOT currently possible (june 2019 release) to assign an NPrinting group to a task, so the task/group combination must be pre-created.
In this example the name of the task is "Email Management Reports" . Make a note of it because we will use the name in the Qlik load script so that we can trigger the task by name.
In this example, the task distributes to the NPrinting Group: Managers . Make a note of the Group name since we will use the Qlik script to update the group membership by group name with the list of user's by name
In this example, the users that will be used are called: Jonathan Poole and NPrinting. Make a note of the names as the script will look up these users by name in order to add them to the NPrinting Group and associate them to the filters.
2. Pre-create the filters that you'd like to apply with each task execution
It is possible to create NP filters on the fly if you truly want a dynamic situation.
No need to associate the filters to the user or task. The script will associate the filters to the user dynamically .
In this example the 3 filters that i'll be using are named: EMEA , ASIA,AMERICAS. Make a note of the name as these filter names will be referenced by the load script which will dynamically associate the filters by name to the user's by name.
3. Edit the load script to load the NP Users and NP Filters that you want applied to each task execution. Each record of the LOAD represents a different execution
In this example recall that the Task was named "Email Management Reports" and the Group was named "Managers" .
Note that you will also have to update the NPrinting server URL, the QlikView Server (from where you are running the load script) as well as the two REST connections to GET and POST requests to the NPrinting API respectively
4. Next is to LOAD the recipient/filter combinations you would like to apply to the NPrinting Publish Task for each iteration:
In this example the task will be executed 3 times , once per record.
The 1st execution will send the report to the user named: NPrinting with the filter: ASIAPAC
The 2nd execution will send the report to the user named: Jonathan Poole with the filter: EMEA
The 3rd execution will send the report to the user named: Jonathan Poole with the filter: AMERICAS
In summary - NPrinting will get the report filtered by the Region=ASIAPAC in 1 email while Jonathan Poole will get two distinct emails.. .one filtering the report by EMEA , the other by AMERICAS
5. There is a summary of the executions presented to the user upon completion