Snow-Shell/servicenow-powershell

Create PDF out of record

mavericksevmont opened this issue · 3 comments

Create PDF out of record

Hi, for audits it is quite useful to be able to download records as PDF, it is quite easy to format the uri based off the sys_id.

e.g. PowerShell Faux Code
$URI = "https://devinstance123.service-now.com/$Table?sys_id=$sys_id&PDF"
Invoke-RestMethod -Uri $URI -Method Get -Credential $Credential -OutFile C:\Temp\Ticket.pdf

Expectation: Create PDF file from a record with a switch or a new function/cmdlet.

I have a working example here in case it's useful:
https://github.com/mavericksevmont/PoshScripts/blob/master/Get-SNowTicket.ps1

If you'd like me to attempt to create it and fork/push, let me know how you'd like to approach this feature request, meaning as a switch on Get-ServiceNowRecord, or maybe as an stand-alone function.

Thank you for taking the time to read my issue!

@mavericksevmont, this is cool. I never knew this existed so thanks for bringing it up! I've put something together, #187, if you wouldn't mind taking a look and reviewing. I provided the same filtering/sorting functionality from Get-ServiceNowRecord and the ability to export to csv, xls, xlsx, xml, and pdf. I couldn't get json to work although the SN docs say it's available.

Wow! That was an incredibly swift response.

Got to test it today and it's working wonders, thank you so much for adding this feature with all the other extras, this is a such a fantastic and well-written module.

Yeah, same here with the json bit, tried it in a dev instance to no avail. But luckily there's a band-aid that can be easily implemented from PowerShell with ConvertFrom-Json.