Comments (14)
Get-ServiceNowRecord can be used to get table info on any table if there isn't a specific function to do so. For example, Get-ServiceNowRecord -Table change_task -Filter @('number', '-eq', $num)
from servicenow-powershell.
To be fair to @MorningsWait and @Chandresh88, the original intent of this issue was to 'create' a change task, not 'get'. I should have suggested we create a new one for 'get', but failed to do so. I'll keep this open until the 'create' aspect is complete.
from servicenow-powershell.
Hello I tried and changed the config can you please check, it is working for me change table name to 'change_task'
i am not sure how to attach the files here
from servicenow-powershell.
Hello Team,
I am new to github as well as to programming, Do we have any template to create the change task in service now?
from servicenow-powershell.
What about just Get-ServiceNowChangeTask ?
I don't see any method to get information about CTASK items. Change requests are prefixed with CHG for the number. Change tasks are prefixed CTASK for the number.
from servicenow-powershell.
What about just Get-ServiceNowChangeTask ?
I don't see any method to get information about CTASK items. Change requests are prefixed with CHG for the number. Change tasks are prefixed CTASK for the number.
So I believe I figured out some bit of RestAPI with a proof of concept to "Get-ServiceNowChangeTask" (change XXX to your environment):
#CTASK number
$num = "CTASKXXX"
#Set variable for credentials
If (-not($cred))
{$cred = Get-Credential}
#Specify endpoint uri for ServiceNow
$uri = "https://XXX.service-now.com/api/now/table/change_task?sysparm_query=number=$Num"
#Specify http method
$method = "get"
#Send http request
$output = (invoke-restmethod -method $method -uri $uri -ContentType "application/json" -Credential $cred).Result
#Print Response
$output
from servicenow-powershell.
I'd like to get away from having a different Get-
function for every table. For 1, there are hundreds of tables and it feels like a losing battle. And 2, the only difference between each function is the table name. I'd like to use Get-ServiceNowRecord
with a tab-ahead perhaps or something similar for -Table
to make it easier for folks and have everyone use that 1 function. Thoughts?
from servicenow-powershell.
Thank you @gdbarron - I have converted my scripts to use this new logic Get-ServiceNowRecord -Table instead.
from servicenow-powershell.
This should be marked as closed or resolved.
from servicenow-powershell.
Hello I tried and changed the config can you please check, it is working for me change table name to 'change_task'
i am not sure how to attach the files here
@Chandresh88 - I just used the following to create a CTASK and it worked fine. Yes, I could have put the values within the $Params, but for legibility with long values - this is preferred.
#Variables
$short_description = 'Short Description here'
$description = 'Description here'
$assignment_group = 'assignment group here'
$assigned_to = 'assigned to here'
$requested_by = 'requested by here'
#Splatting the variables to the Cmdlet
$Params = @{
short_description = $short_description
description = $description
assignment_group = $assignment_group
assigned_to = $assigned_to
requested_by = $requested_by
}
$Record = New-ServiceNowRecord -Table 'Change Task' -Values $Params -PassThru
Write-Output -InputObject $Record.number
from servicenow-powershell.
I believe this still needs to be worked on as well as we can do all 3 tasks get/modify/Delete
from servicenow-powershell.
@MorningsWait, do you have a suggestion as to which change task fields are most used so we can include them in a New-ServiceNowChangeTask
? According to the dev instance, looks like short description and description are required and I assume we'll need the change request number. What else are you thinking?
from servicenow-powershell.
@MorningsWait following up...
from servicenow-powershell.
I am sorry for responding late, Short Description, Description, Parent CHG, Assignment Group & Assigned To the
from servicenow-powershell.
Related Issues (20)
- Filtering on nested property doesn't work HOT 2
- Expanding the CustomVariable HOT 2
- Add-ServiceNowAttachment Error - "Item has already been added. Key in dictionary: 'Content-Type' Key being added: 'Content-Type'" HOT 2
- Attachment Download functionality is gone in New Get-ServiceNowAttachment HOT 4
- Custom Variable 'Reference' Type Value is Incorrect HOT 4
- Updating a Non-Catalog Request HOT 3
- Error with v3.4.3 HOT 3
- Comments still reference deleted function Get-ServiceNowUser HOT 1
- Zero size files cause 'Bad Request' error HOT 1
- How do you add associated CIs to a Change record? HOT 3
- Cannot Close Sctask that requires text in worknotes field not posted and closed task clicked in gui HOT 3
- Allow timeout to be specified for Get-ServiceNowRecord HOT 5
- BasicAuth fails when authentication profiles are active on ServiceNow HOT 2
- Why New-ServiceNowChangeTask does not link the new task to the main change ticket?
- Number of records different when using the filter vs where. HOT 1
- JSON Square Brackets Added to Array's First and Last Objects HOT 4
- Error when using -IncludeCustomVariable: Id must either be a SysId 32 character alphanumeric or Number with prefix and id.
- Updating dmn_demand_task is not working HOT 5
- Prevent exception thrown by [DateTime]::ParseExact()
- Use serviceNow style filter with Get-ServiceNowRecord
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from servicenow-powershell.