- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 07:11 AM
Hi,
I have been tasked with creating a form that will execute a PowerShell to return a csv template. I know that I can store templates on the catalog item as an attachment and retrieve it that way, unfortunately, the template changes often. This is why I have to execute a PowerShell to retrieve the data and user script to turn it into a csv.
Does anyone know the best way to achieve this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 07:46 AM
Without knowing the specifics and assuming you want this to be visible on a catalog item in a Service Portal:
You would have to create a portal widget and leverage that in a variable (type custom).
I would personally prefer to call a flow designer flow from that widget to retrieve what is necessary using integration hub, and the use the output to display in the widget, but there may be other ways.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 07:45 AM
for executing powershell you need to have mid server setup.
where is that csv file present? is it in windows machine?
check these links on how to bring file from mid server
File Import (CSV / XLS) file from Mid Server location
CSV file from MIDserver to ServiceNow instance
How to import excel file from Mid Server to import set table in service now.
How to import a CSV file from a MID Server
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 07:46 AM
Without knowing the specifics and assuming you want this to be visible on a catalog item in a Service Portal:
You would have to create a portal widget and leverage that in a variable (type custom).
I would personally prefer to call a flow designer flow from that widget to retrieve what is necessary using integration hub, and the use the output to display in the widget, but there may be other ways.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:06 AM - edited 06-26-2023 09:07 AM
Hi @Peter Bodelier,
So you are saying to call a flow instead of executing PowerShell? Let Flow execute the PowerShell and retrieve the response as well as create the csv. I like this idea. Would I still use the widget to call the flow?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 09:15 AM
@Dazler, yes, correct and yes you will need the widget to execute the flow. You could execute it from client script, but I don't think there would be a good way to present the csv that way.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.