email_report

Emails a report.

Path:
/lib/email_report.js

Parameters:

NameTypeDescription
ParametersArray of ObjectsAn array of parameters to use in the query.
Parameters.DisplayValueStringThe display value of the parameter.
Parameters.NameStringThe name of the parameter.
Parameters.ValueStringThe value of the parameter.
ReportFormatStringThe format to produce the report in. Can be set to "csv" or "html". If not specified, an Excel report named "Report.xlsx" will be generated and attached to the email.
ReportNameStringThe name to assign to the report.
SelectQueryStringThe query to run for generating report data.
SubjectStringThe text to use for the email subject.
ToStringThe email address of the recipient.

Example Request:

POST /redrock/query

{  
   "Script":"@/lib/email_report.js",
   "Args":{  
   	  "SelectQuery": "Select ID from VaultAccount where User = \"Administrator\"",
   	  "Parameters":
   	  [
   	  	{
   	  		"Name" : "TestParam0",
   	  		"DisplayValue" : "Test0",
   	  		"Value" : "TestValue0",
   	  	}
   	  ],
   	  "To":"[email protected]",
   	  "Subject": "Test report",
   	  "ReportFormat": "html",
   	  "ReportName" : "MyReport"
   }   
}

Example Response:

"Query has failed: Parameter to may not be null or whitespace\r\nParameter name: to\r\nLine: 19 Char: 1\r\nNo source code available.",