- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 03:32 AM
Hi All,
I am needing to creare a powershell script which uses the Rest API to create a catalog task.
(so that we can use some automation to create tasks on the back of other scripts that we have running)
I have managed to do this, and i can get the short description and description populated, but i cant seem to find a way to populate the "requested for",Location, assignment group or assigned to fields.
Could someone help please ?
The body of my request so far is :-
$body = "{`"short_description`":`"This is a test ticket - please ignore`",`"description`":`"Please see this full test description`",`"sys_created_by`":`"Some User`",`"Location`":`"c90f20c5dbe46b04f1267b5b8c961964`"}"
The description and the short description get populated, but the location doesnt, I have tried text or sys_id for the location but neither works.
And i dont know what variable names to use for assdignment group etc but if the location doesnt work then im presuming that wont either
Thanks in advance 🙂
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 03:57 AM
You'll have to use the field names instead of labels.
For example Location is "location", Assignment group is "assignment_group" and Assigned to is "assigned_to".
They're all reference fields so you should be able to populate them correctly when you provide a sys_id available in servicenow.
Requested for (requested_for) is not a field on catalog task table, but instead is actually on the requested item table, so you can't modify that for the catalog task. If you want to change it then you'll have to change the value on requested item, but that will change it for all the tasks as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 03:57 AM
You'll have to use the field names instead of labels.
For example Location is "location", Assignment group is "assignment_group" and Assigned to is "assigned_to".
They're all reference fields so you should be able to populate them correctly when you provide a sys_id available in servicenow.
Requested for (requested_for) is not a field on catalog task table, but instead is actually on the requested item table, so you can't modify that for the catalog task. If you want to change it then you'll have to change the value on requested item, but that will change it for all the tasks as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 05:56 AM
Brilliant, thank you - thats what i needed