- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 02:46 AM
Hi All,
I have been successfully able to create a new service request through scripting by using the CartJS API.
My code is given below - which is perfectly working.
Now what I want is - to return the new RITM Number after the last step in the below code.
Any help would be much appreciated.
var cart = new sn_sc.CartJS();
var ritm = {
sysparm_id: "3ecb3552979f3110060cbb5ef053afcf",
sysparm_quantity: "1",
sysparm_requested_for: inputValues.requested_for,
variables: {
requested_for: inputValues.requested_for,
requested_by: inputValues.requested_by,
os_type: inputValues.os_type,
},
};
cart.addToCart(ritm);
cart.checkoutCart(); //working perfectly fine - how to return this new RITM number?
Please mark this post as a solution and also as helpful, if this resolves your issue or query.
Thanks,
Subhadeep Ghosh.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 06:04 AM
Hello @subhadeep1618 ,
You can use the below script to get the REQ number, for getting RITM number query the table using GlideRecord.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 06:04 AM
Hello @subhadeep1618 ,
You can use the below script to get the REQ number, for getting RITM number query the table using GlideRecord.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-29-2023 08:42 PM
Hi @Community Alums ,
Thanks a lot for your help.
Yes, this works.
In fact, I returned the entire object and it looks even better.
{
"result": [
{
"number": {
"request_number": "REQ0010112",
"request_id": "32390267971bb510060cbb5ef053afc3"
}
}
]
}
Please mark this post as a solution and also as helpful, if this resolves your issue or query.
Thanks,
Subhadeep Ghosh.