CORE: Set the task_for in RITM while creating through REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 12:54 PM
Hello,
Need to set TASK_FOR in RITM, while calling catalog API (sn_sc). The rest API is called using service account. The task_for is getting value of service account.
I tried following payload, but task_for, opened_by, requested_for would not update to specific user.
{
"sysparm_quantity": "1",
"requested_for": "d6d9285e1b2350d031070fedee4bcbce",
"opened_by": "d6d9285e1b2350d031070fedee4bcbce",
"task_for": "d6d9285e1b2350d031070fedee4bcbce",
"variables": {
"var1": "value"
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 05:23 PM
In ServiceNow, when creating a Requested Item (RITM) through the Service Catalog API (sn_sc), setting the task_for, opened_by, and requested_for fields requires the use of the correct REST API endpoint and the correct payload format.
Use the sn_sc/servicecatalog/items/createRequest endpoint.
Make a POST request to this endpoint.
Sample payload -
{
"sysparm_quantity": "1",
"cat_item": "Catalog Item Sys ID", // Replace with the sys ID of the catalog item
"variables": {
"var1": "value",
"opened_by": "User Sys ID", // sys ID of the user who opened the request
"requested_for": "User Sys ID", // sys ID of the user for whom the request is made
"task_for": "User Sys ID" // sys ID of the user for whom the task is created
}
}
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar