Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the Sys_Id information on an already existing service now incident #95

Closed
ghost opened this issue Oct 9, 2019 · 7 comments
Closed
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Oct 9, 2019

Hello, is there an existing way to grab the sys_id for an already existing ticket/incident number in service now? What I am trying to do is update an incident which wasn't created by the service now module, but I can't find a way to grab the sys_id without actually creating a ticket using your module.

@Rick-2CA
Copy link
Member

Rick-2CA commented Oct 9, 2019

image

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

@Rick-2CA Rick-2CA self-assigned this Oct 9, 2019
@ghost
Copy link
Author

ghost commented Oct 9, 2019

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

@Rick-2CA
Copy link
Member

Rick-2CA commented Oct 9, 2019

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'}.

@ghost
Copy link
Author

ghost commented Oct 10, 2019

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

@Rick-2CA
Copy link
Member

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.

@ghost
Copy link
Author

ghost commented Oct 14, 2019

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...

@Rick-2CA
Copy link
Member

Rick-2CA commented Oct 21, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant