Code Monkey home page Code Monkey logo

Comments (7)

Rick-2CA avatar Rick-2CA commented on August 13, 2024

image

You query for the ticket and the data returned includes sys_id.

from servicenow-powershell.

 avatar commented on August 13, 2024

What would the command look like to return the sys_id if I already know the ticket/incident number?

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on August 13, 2024

You'd do Get-ServiceNowIncident -MatchExact @{number='INC0123456'} to get the number you want. You could add -Properties sys_id to only pull back the sys_id if you want (or any specific list of properties). Otherwise it'll pull back default values.

Or for what you described you can take advantage of Update-ServiceNowNumber by passing the number and table and let it look up the sys_id for you by doing Update-ServiceNowNumber -Number INC0123456 -Table incident -Values @{property='value'}.

from servicenow-powershell.

 avatar commented on August 13, 2024

so the command Get-ServiceNowIncident -MatchExact @{number='ticket_number'} works for querying the sys_id for tickets created using your service now module. But when I try to query a ticket_number which was created from the web interface of service now, nothing is returning... Any idea what could be happening? Thank you

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on August 13, 2024

The PowerShell module interacts with the ServiceNow database just like the web interface does. What you may be running into is the type of ticket you're searching for. Get-ServiceNowIncident queries the incident database specifically. That's a ticket with a number that begins with INC. If you're trying to find a different ticket type you'd need to use the corresponding command. If that command doesn't exist you'd want to use Get-ServiceNowTableEntry and specify the table name that has your ticket. That's how you'd query for custom ticket tables for example.

from servicenow-powershell.

 avatar commented on August 13, 2024

I'm still trying to query an incident, just not created with the powershell module and instead from the web interface. Is it possible that when I create a ticket from the web interface that the ticket is being stored under a different table other than incident? I'm not sure what else to try...

from servicenow-powershell.

Rick-2CA avatar Rick-2CA commented on August 13, 2024

If you open the ticket in the web you should get a URL such as https://tenant.service-now.com/nav_to.do?uri=%2Fsc_req_item.do%3 and be able to see which table you're looking at. In this example my URL shows me in the sc_req_item table. Could help you confirm which database you're working in. It should be the incident table from what you described.

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.