Set assignment_group using CartAPI script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 02:16 PM
Good evening, how are you? Could someone please help me set an assignment_group using a script with the Cart API? My script is currently written like this:
If anyone could assist me, I would be immensely grateful. Thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 08:30 PM
Hi @HudyssonPOntes,
I found an answer from another question - https://www.servicenow.com/community/developer-forum/using-cart-placeorder-return-object/m-p/1621741
Although I wouldn't recommend using a script to set the assignment group via a script.
You want to have a 'central' place to store the logic for assignment and using an Assignment Rule would be a better approach here.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 10:08 PM
you can't set the assignment_group field on RITM using cart API, it can only set the variables associated to catalog item
You can update the RITM once cart is submitted
something like this
// your earlier code
var reqNumber = rc.number;
var ritm = new GlideRecord('sc_req_item');
ritm.get('request.number', reqNumber);
ritm.assignment_group = 'groupSysId';
ritm.update();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2025 11:17 PM
Hello @HudyssonPOntes ,
As others have already pointed out it's not possible to set the Assignment group of a request via the Cart API.
That would be like ordering something at Amazon but also telling them which internal team should work on your order.
Instead, your Catalog Item should be tied to a Flow/Workflow, and it's there that the assignment should happen. Or you can also use Assignment Rules.
Regards,
Robert