REST Table API to trigger a Catalog Item request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 02:24 PM
Hello.
I'm working on an external form for users to fill out and submit into SN via the REST Table API.
If I create a catalog item in SN, is it possible to use this API to request this catalog item by inserting a new record into the Service Catalog Requested Item [sc_req_item] table, and thereby triggering the corresponding approval workflow? Will this work?
If yes, will need to figure out what required fields to be populated at a minimum in order for this to work.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2016 04:05 PM
I think Geneva may have Scripted Web Services available for REST. In the meantime, you could create a new custom table, and REST into it, and using the link I provided before, records into that custom table via REST could trigger a business rule that will submit the Cart API for a regular Item submission. Its almost like a Direct Web Services model where you have an import set table to stage the data before you act on it. In this case, REST can insert into the staging table and the business rule can parse that data into the Cart API. I've never done this before, but in theory it should work. The external form would enforce the required fields of the catalog form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2016 06:27 AM
Hi Van.
I created a new table for my app and I made it extend Task. One of the new column is for an email address. I was then table to insert a new record into this table, and trigger a workflow attached to it. That's progress However my workflow has a notification activity where I'd like to be able to select the email field from table record: I click on the lock to Edit To, click the Select Fields icon, and there I see fields like Assigned To and Closed By (from the Task table I presume) but I do not see my the Email field from my table record. Are you familiar with this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2016 10:35 AM
Hi Pat
When I mentioned creating a new custom table, and it doesn't have to extend the task table, that was only so that the external web form could use that custom table to stage a proper submission of a catalog item using the ServiceNow provided Cart API via business rules (submitting a catalog item via script I provided before), then it would work like that standard catalog for Request, Approval, Item and Task. This the path I would suggest.
But to answer your question, the fields you see are from the Task table or whatever table you selected on the Workflow properties, but its only looking for Reference type fields that can potentially extend to a table that has the email field, say the User table. So that's why you see Assigned to and Assignment Group. A regular string/text field that holds an email address will not show up here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2016 08:57 AM
Thx Van. Any ideas on how my workflow could retrieve that email address from the newly inserted record and use it to send an email notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2016 02:12 PM
If the information submitted via the REST API contains the email address, and it lands in that custom table as a text field for staging, I am assuming that information would be submitted into the Catalog API to create the catalog request. If this is the case, it will be available for reading to the workflow as a Requested Item variable. This can be accessed as 'current.variables.[name_of_the_variable]' to the workflow. So for example. if the field on the catalog item submitted was called 'email', then for the Notification activity, check Advanced, and add something like 'answer = current.variables.email;'.