Service Catalog Task Client Script accessing item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2012 08:00 PM
I am trying to access the name of the Service Catalog Item in a sc_task client script. I seem to be able to get the sys_id of the item with the following ... var item = g_form.getReference('request_item').cat_item; ... if possible I would like to get the name.
I tried var item = g_form.getReference('request_item').cat_item.name; but that just gives me undefined. I also tried var item = g_form.getReference('request_item').name; ... that also gives me undefined. I can get the short description by using var item = g_form.getReference('request_item').short_description; ... Would anyone know how to get the name of the item?
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2012 08:41 PM
'getReference' will only let you dot-walk one level deep - which in this case will let you get the sys_id of the catalog item associated to your request item record. If you want to get information about the catalog item (the name for example) you have to perform a second query against the catalog item table using the sys_id of the item.
You'll want to be careful doing this though as it will cause a momentary lockup of the browser which may be perceived as a performance problem when it's really bad design. I would recommend using GlideAJAX to perform the whole query on the back-end with an async query. You can find more information about GlideAJAX on the wiki.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2012 06:22 AM
Thank you!