Getting the value of Catalog from Approval table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2018 07:04 AM
Hi All
For the RITM records in sysapproval_approver table, I'm trying to get the value of catalog that the item belongs to.
I'm using 'sysapproval.cat_item.sc_catalogs' (taskGR.addQuery('sysapproval.cat_item.sc_catalog','catalogs');) to get this value but that does not give me the correct value I guess because there is no change in the number of records queried after applying this filter.
Can anyone help me to know what query should be used to get the catalog name from sc_catalog table for a given approval record.
Thanks,
Nisha
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 07:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 09:39 AM
Hi Richard,
Thanks for pointing out about using encoded query for user.
about the query not working, the display value and value are same in the choice field, both PT.
Moreover I tested with
var n = taskGR.getValue('sysapproval.u_request_type')
gs.log("test: "+n);
and in logs it shows test: null.
I also tested using encodedquery from list view
taskGR.addEncodedQuery('u_request_type=PT'); but still did not work.
Thanks,
Nisha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2018 11:37 AM
Nisha,
it looks like the getvalue doesn't like dot-walking. i can try to get to the sysapproval records directly (gr.sysapproval.requested_for) or with getRefRecord. hope this works better.
var gr = new GlideRecord('sysapproval_approver');
gr.get('50840e3d4ff56300ffef3879b110c738');
var x = gr.sysapproval.getRefRecord();
gs.print(gr.getValue('sysapproval.requested_for'));
gs.print(x.getValue('requested_for'));
gs.print(gr.sysapproval.requested_for);
*** Script: null
*** Script: 6816f79cc0a8016401c5a33be04be441
*** Script: 6816f79cc0a8016401c5a33be04be441
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2018 12:56 AM
In my case both of the queries return undefined value.
var x = taskGR.sysapproval.getRefRecord();
gs.log(x.getValue('u_request_type'));
gs.log(taskGR.sysapproval.u_request_type);
The only difference I see is the field type. The one I'm querying to is of type choice and a custom field.
Not sure if that is causing the issue.
Thanks,
Nisha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2018 10:29 AM
You need to pass the sysid of the catalog in the query, because it is a list field.
taskGR.addQuery('sysapproval.cat_item.sc_catalog','catalog sysid');
Please mark this response as correct or helpful if it assisted you with your question.