Code Monkey home page Code Monkey logo

Comments (14)

gdbarron avatar gdbarron commented on August 13, 2024 1

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.

gdbarron avatar gdbarron commented on August 13, 2024 1

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.

MorningsWait avatar MorningsWait commented on August 13, 2024

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.

Chandresh88 avatar Chandresh88 commented on August 13, 2024

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.

wwwb0n3zcom avatar wwwb0n3zcom commented on August 13, 2024

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.

wwwb0n3zcom avatar wwwb0n3zcom commented on August 13, 2024

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.

gdbarron avatar gdbarron commented on August 13, 2024

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.

wwwb0n3zcom avatar wwwb0n3zcom commented on August 13, 2024

Thank you @gdbarron - I have converted my scripts to use this new logic Get-ServiceNowRecord -Table instead.

from servicenow-powershell.

wwwb0n3zcom avatar wwwb0n3zcom commented on August 13, 2024

This should be marked as closed or resolved.

from servicenow-powershell.

wwwb0n3zcom avatar wwwb0n3zcom commented on August 13, 2024

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.

MorningsWait avatar MorningsWait commented on August 13, 2024

I believe this still needs to be worked on as well as we can do all 3 tasks get/modify/Delete

from servicenow-powershell.

gdbarron avatar gdbarron commented on August 13, 2024

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

gdbarron avatar gdbarron commented on August 13, 2024

@MorningsWait following up...

from servicenow-powershell.

MorningsWait avatar MorningsWait commented on August 13, 2024

I am sorry for responding late, Short Description, Description, Parent CHG, Assignment Group & Assigned To the

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.