- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 07:50 AM
from the sc_task table, I have the following:
function onLoad(){
var reqitem = g_form.getReference('request_item');
//alert(reqitem.cat_item);
if (reqitem.cat_item == ('hardcodedsysidpleasedontshootme') || reqitem.cat_item == ('ipromisetomovethistoasysproperty'))
{
so I know from the Task, I can get the request_item as it is on the form and from that reference I can get the cat_item
But up a level, if I want to get the cat_item from the sc_req_item itself !! It is not present on the form so how I can access it?
Should I just add the item to the form?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2016 08:10 AM
I have found that if a field is not available on the form it is not found using g_form methods. You could make the field available on the form, then create a UI Policy that hides it since it probably is not needed on the sc_req_item form. Then your g_form methods will work.
Let us know if you are still unsuccessful,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2016 03:21 AM
Another solution to placing the field on the form and then hiding it with a UI action is to use g_scratchpad to pass the value from the server side to the client side. Then you know it's always available even if someone re-arranges the form layout later.
http://wiki.servicenow.com/index.php?title=Client_Script_Best_Practices#Example:_g_scratchpad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2016 06:03 AM
The thing I like about this is it is Best Practice and is somewhat future proof - thank you