GithubHelp home page GithubHelp logo

Comments (9)

Rick-2CA avatar Rick-2CA commented on July 24, 2024 1

@BristleBeard - No time frame I'd want to quote. If you'd like to play with the functions I've set them up for download.

Any feedback you have would be appreciated if you use the files.

from servicenow-powershell.

gdbarron avatar gdbarron commented on July 24, 2024

Hey there, started looking at your project and thought I would try and contribute.

You could provide update functionality by combining add and remove. You still need the separate add/remove functions, just adds to ease of use. Perhaps provide a -allowclobber or similar parameter to deal with multiple files that already exist with the same name when someone tries to update (you'd need to allow removal by name as well as sys_id).

I'm just getting into the SN API and probably just my lack of knowledge, but not sure I understand the difference between add and save. In fact, looking at the rest api, I don't see a save option. Is it a 2 step process, add and then save?

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on July 24, 2024

We could do an Update command that simply removes and adds. I'm afraid to play with anything by name though. I ran across a ticket in my org this week that had 10+ files with the same name attached. No idea why. One would hope anyone doing an update would only have one of each name, but I'd hate to blow away someone's data by trying to work off of name when the back end relies upon sys_id and the accuracy that provides.

If you look here the top two GET calls get metadata. The third GET call gets the binary file - or the bits necessary to create the attachment. The Save function uses that third option to save the file locally (download).

I hope you like the project and can contribute. Thanks for the reply.

from servicenow-powershell.

gdbarron avatar gdbarron commented on July 24, 2024

That was one of the use cases I was thinking of. Someone mistakenly attaches multiple files with the same name and wants to remove them all. We could ensure we use confirmations and alert them to how many they will be removing before we do so. I understand your hesitation to provide this. I definitely get that sys_id is unique, but people will recognize a file by name, not sys_id so thought this might be better.

Another option might be to provide an All parameter to the remove function and of course provide the same confirmation.

Thanks for the link, makes sense now. I thought we were adding the attachment to the ticket, kind of like queuing it up, and then saving. Maybe instead of Get-ServiceNowAttachment call it Get-ServiceNowAttachmentDetail and instead of Save-ServiceNowAttachment calll it Get-ServiceNowAttachment with an optional file path parameter? This would give someone the ability to either get the binary response and perform additional actions or save it to a file.

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on July 24, 2024

I chatted with someone in the PowerShell Slack today who suggested Read-ServiceNowAttachent to get the details and Get-ServiceNowAttachment to perform the download. That coincides with the logic written in Get vs Read, but I hesitate to take that route. The Read verb is not often used and doing Read | Get strikes me as less clear than the other two options.

Right this minute I'm leaning towards Get-ServiceNowAttachmentDetail and Get-ServiceNowAttachment. Going with the idea that Save is for a state, not for a download.

from servicenow-powershell.

gdbarron avatar gdbarron commented on July 24, 2024

I like the link, great info, thanks.

from servicenow-powershell.

BristleBeard avatar BristleBeard commented on July 24, 2024

Do you have a timeframe that you may roll this feature out? I'm actually researching how to add an attachment now, so it'd be nice to not reinvent the wheel! :)

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on July 24, 2024

PR #78 has been submitted for attachment management. Would appreciate a review of the changes if anyone is so inclined. There are changes not included in the download I linked above for BristleBeard.

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on July 24, 2024

Published to prod in #79

from servicenow-powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.