Var grCatItem = new GlideRecord ( "sc_cat_item" ) "special_instructions" : "Please don't drop the thing" , "Additional_software_requirements" : "I would like this thing" , Some request and request item data that we'll use later. sys_id of the "Standard Laptop" catalog item. Note that after the REQ's approval state is set to approved, it will automatically update the RITM's underneath it and kick-off their flows / workflows. Create the REQ, populating the "Requested for".Automatically updates the request's "Requested for" from those special "Requested for" variables, if the request has any of them.Calculates the price based on the item, chosen options, certain field values, etc.In short, ServiceNow does the following when you submit a new request: You should not ever do this! I'm only doing this to show you a bit of what happens behind the scenes. You can always create a new catalog request entirely manually. placeOrder ( ) // The placeOrder() function returns a GlideRecord for the sc_request record it generates Option 3 - Create it all yourself setVariable (myRitm, 'storage', '1tb' ) /**/ setVariable (myRitm, 'os', 'win10' ) /* Catalog item variables can be populated */Ĭart. Var cart = new Cart (id ) // Instantiate a fresh cart using the random GUID from earlier Once open, you may not be able to view the script because ServiceNow really does not want you to use it. To see more, open the script include "Cart" in your instance of ServiceNow. You should expect unexpected behaviour when using it. This is the old and deprecated method of creating new RITMs through script.īecause the script include is deprecated, or you may not be able to view the script at all. !/reference/api/tokyo/server/sn_sc-namespace/c_CartJSScoped Option 2 - Cart There's many more options that you can use when submitting a new request. "sysparm_requested_for" : "SYS_ID_OF_REQUESTED_FOR_USER" , This robust script API should do all of the magic for you that you'd expect when you manually submit a request by hand. Option 1 - sn_sc.CartJSĪt the time of writing this article, this is the recommended method to create new RITMs (catalog requests) through script. It's important that the way you do it includes this magic. There's a lot of magic that ServiceNow does automatically when you submit a service catalog request. A transform map that needs to import data as catalog requests.A shortcut or UI action that should automatically create a new service request from another record.A scheduled script job that creates requests when it finds something.Sometimes in ServiceNow, you'll have the need to submit a new Service Catalog Request without the user, typically using script.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |