i am not able to post Requested for field using the API explorer to the sctask table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 12:57 AM
i am using buy item ( post) , using catalog task API . it is getting a blank field on it . when the req is created
{
"sysparm_quantity" :"1",
"variables":{
"requested_for" : "",
"type_of_room_sqeep_00" : "",
"time_of_room_sweep" : "",
"building" : ",
"select_location_00" : ",
"business_justification" : ""
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 06:25 AM
@Ankur Bawiskar i am getting if i am using the above script
{
"error": {
"message": "com.glide.rest.domain.ServiceException: Exception while reading request",
"detail": ""
},
"status": "failure"
}
var cart = new sn_sc.CartJS(); var item = { // Note that values using CartJS are instantiated via a JSON object 'sysparm_id': '060f3afa3731300054b6a3549dbe5d3e', 'sysparm_quantity': '1', 'variables': { 'requested_for': 'David Cher', } }; var cartVals = cart.addToCart(item); // The addToCart function returns a JSON object reflecting the status of the cart var checkoutVals = cart.checkoutCart(); // The checkoutCart function returns a JSON object with info about the submitted cart, contents varying if two-step checkout is active
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 02:22 AM
Hello,
Requested for is a field on request table, doesn't necessarily have to be a variable on maintain item until unless you created that variable. In above JSON body it looks like the requested for is assigned inside variable object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 03:44 AM
do you mean to use this in the REST API explorer ?
var id = GlideGuid.generate(null); // Generate a new GUID var cart = new Cart(id); // Instantiate a fresh cart var RITM = cart.addItem('060f3afa3731300054b6a3549dbe5d3e'); // The value used here is the sys_id of our laptop catalog itemcart.setVariable(RITM,'ram','16'); /**/cart.setVariable(RITM,'os','win10'); /* Catalog item variables can be populated */ cart.setVariable(RITM,'storage','1tb'); /**/ var request = cart.placeOrder(); // The placeOrder() function returns a GlideRecord for the sc_request record it generates