Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
waterscg
Creator
Creator

Generate a report of users for which an email could not be delivered?

My NPrinting business users generate and email many reports to other internal users. If a publish task is configured to include the sending of the email to a user who has left the company, a warning is generated when the task runs. The task log displays the user's GUID but not their name.

When a publish task runs, is there a way to generate an ancillary report of the users for which the email could not be delivered? Such a report would be very useful to the business users.

Labels (1)
2 Solutions

Accepted Solutions
Ruggero_Piccoli
Support
Support

Hi,

I suggest you to enable the Audit Trail as explained in https://help.qlik.com/en-US/nprinting/May2022/Content/NPrinting/AdministeringQVNprinting/Audit-trail.... Email events are logged with:

- Target = Email

- Action in your case = Failed

Audi Trail has its own database so you can connect directly to the DB from a QlikView or Qlik Sense app without the need to connect to the Qlik NPrinting repository which could be dangerous. 

Better alternative mentioned by @andregas is to use Audit APIs that are documented at https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=9#Audit

To decode the RecipientID you can use the API https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=66

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.

View solution in original post

Ruggero_Piccoli
Support
Support

Hi,

Qlik NPrinting APIs for Audit are documented in https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=9

Qlik Sense REST connector is documented in https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/REST-c...

You can create a new Qlik Sense app, insert a REST connection to the Qlik NPrinting server in the data load script and add the following code:

//Perform a GET call to NPrinting NTLM login API
RestConnectorMasterTable:
SQL SELECT
"Set-Cookie",
"__KEY__response_header"
FROM JSON "_response_header" PK "__KEY__response_header";
[_response_header]:
LOAD [Set-Cookie] AS [Set-Cookie]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY__response_header]);

//Extracts session cookie from the API response
let vCookieRaw = Peek('Set-Cookie',0,'_response_header');
Let vCookie = TextBetween(vCookieRaw,'SameSite=None,',' Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);

DROP TABLE RestConnectorMasterTable; 

// Get Audit Trail 


RestAuditTrailTable:
SQL SELECT
"__KEY_data",
  (SELECT
  "id",
  "userId",
  "userName",
  "ipAddress",
  "source",
  "target",
  "targetId",
  "targetName",
  "appId",
  "eventTime",
  "action",
  "description",
  "dataType",
  "__KEY_items",
  "__FK_items",
//  "data",
     (SELECT 
		"title",
        "format",
        "taskId",
        "fileSize",
        "published",
        "executionId",
        "recipientId",
        "authenticationType",
        "status",
        "taskName",
        "taskType",
        "triggerId",
        "__FK_data"
     FROM "data" FK "__FK_data")
  FROM "items" PK "__KEY_items" FK "__FK_items")
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "https://NPrintingServerAddress:4993/api/v1/audit/events", HTTPHEADER "cookie" "$(vCookie)", QUERY "Limit" "1000");

[Data]:
LOAD 
	[title] AS [data_title],
    [format] AS [data_format],
  	[taskId] AS [data_taskId],
    [fileSize] AS [data_fileSize],
    [published] AS [data_published],
    [executionId] AS [data_executionId],
    [recipientId] AS [data_ecipientId],
    [authenticationType] as [data_authenticationType],
    [status] as [data_status],
    [taskName] as [data_taskName],
    [taskType] as [data_taskType],
    [triggerId] as [data_triggerId],
	[__FK_data] AS [__KEY_items]
RESIDENT RestAuditTrailTable

[Audit]:
LOAD 
  [id] AS [audit_id],
  [userId] AS [audit_userId],
  [userName] AS [audit_userName],
  [ipAddress] as [audit_ipAddress],
  [source] as [audit_source],
  [target] as [audit_target],
  [targetId] as [audit_targetId],
  [targetName] as [audit_targetName],
  [appId] as [audit_appId],
  [eventTime] as [audit_eventTime],
  [action] as [audit_action],
  [description] as [audit_description],
  [dataType] as [audit_dataType],
  [__KEY_items] as [__KEY_items],
  [__FK_items] as [__KEY_data]
RESIDENT RestAuditTrailTable

DROP TABLE RestAuditTrailTable;

Of course, you can customize the reload script by adding or removing fields, filtering them, etc.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.

View solution in original post

5 Replies
Jacob_Poole
Contributor III
Contributor III

Agree this would be useful.

andregas
Partner - Creator II
Partner - Creator II

Hello @waterscg ,

You could do it in Qlik View/Sense, you could develop an app that connect to NPrinting API and retrive the informations.

Ruggero_Piccoli
Support
Support

Hi,

I suggest you to enable the Audit Trail as explained in https://help.qlik.com/en-US/nprinting/May2022/Content/NPrinting/AdministeringQVNprinting/Audit-trail.... Email events are logged with:

- Target = Email

- Action in your case = Failed

Audi Trail has its own database so you can connect directly to the DB from a QlikView or Qlik Sense app without the need to connect to the Qlik NPrinting repository which could be dangerous. 

Better alternative mentioned by @andregas is to use Audit APIs that are documented at https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=9#Audit

To decode the RecipientID you can use the API https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=66

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
waterscg
Creator
Creator
Author

Thanks. I've enabled the Audit Trail setting.

>>Audi Trail has its own database so you can connect directly to the DB from a QlikView or Qlik Sense app without the need to connect to the Qlik NPrinting repository ...

How does one connect to the Audit Trail database from Qlik Sense?

Ruggero_Piccoli
Support
Support

Hi,

Qlik NPrinting APIs for Audit are documented in https://help.qlik.com/en-US/nprinting/May2022/APIs/NP+API/index.html?page=9

Qlik Sense REST connector is documented in https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Connectors_REST/REST-c...

You can create a new Qlik Sense app, insert a REST connection to the Qlik NPrinting server in the data load script and add the following code:

//Perform a GET call to NPrinting NTLM login API
RestConnectorMasterTable:
SQL SELECT
"Set-Cookie",
"__KEY__response_header"
FROM JSON "_response_header" PK "__KEY__response_header";
[_response_header]:
LOAD [Set-Cookie] AS [Set-Cookie]
RESIDENT RestConnectorMasterTable
WHERE NOT IsNull([__KEY__response_header]);

//Extracts session cookie from the API response
let vCookieRaw = Peek('Set-Cookie',0,'_response_header');
Let vCookie = TextBetween(vCookieRaw,'SameSite=None,',' Path=/',SubStringCount(vCookieRaw,'SameSite=None')-1);

DROP TABLE RestConnectorMasterTable; 

// Get Audit Trail 


RestAuditTrailTable:
SQL SELECT
"__KEY_data",
  (SELECT
  "id",
  "userId",
  "userName",
  "ipAddress",
  "source",
  "target",
  "targetId",
  "targetName",
  "appId",
  "eventTime",
  "action",
  "description",
  "dataType",
  "__KEY_items",
  "__FK_items",
//  "data",
     (SELECT 
		"title",
        "format",
        "taskId",
        "fileSize",
        "published",
        "executionId",
        "recipientId",
        "authenticationType",
        "status",
        "taskName",
        "taskType",
        "triggerId",
        "__FK_data"
     FROM "data" FK "__FK_data")
  FROM "items" PK "__KEY_items" FK "__FK_items")
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH CONNECTION( URL "https://NPrintingServerAddress:4993/api/v1/audit/events", HTTPHEADER "cookie" "$(vCookie)", QUERY "Limit" "1000");

[Data]:
LOAD 
	[title] AS [data_title],
    [format] AS [data_format],
  	[taskId] AS [data_taskId],
    [fileSize] AS [data_fileSize],
    [published] AS [data_published],
    [executionId] AS [data_executionId],
    [recipientId] AS [data_ecipientId],
    [authenticationType] as [data_authenticationType],
    [status] as [data_status],
    [taskName] as [data_taskName],
    [taskType] as [data_taskType],
    [triggerId] as [data_triggerId],
	[__FK_data] AS [__KEY_items]
RESIDENT RestAuditTrailTable

[Audit]:
LOAD 
  [id] AS [audit_id],
  [userId] AS [audit_userId],
  [userName] AS [audit_userName],
  [ipAddress] as [audit_ipAddress],
  [source] as [audit_source],
  [target] as [audit_target],
  [targetId] as [audit_targetId],
  [targetName] as [audit_targetName],
  [appId] as [audit_appId],
  [eventTime] as [audit_eventTime],
  [action] as [audit_action],
  [description] as [audit_description],
  [dataType] as [audit_dataType],
  [__KEY_items] as [__KEY_items],
  [__FK_items] as [__KEY_data]
RESIDENT RestAuditTrailTable

DROP TABLE RestAuditTrailTable;

Of course, you can customize the reload script by adding or removing fields, filtering them, etc.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.