Query question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 05:17 AM
I am trying to pull back the records of a particular field in a table. The query is done on the catalog task so I have to glide to the table where the records reside. Can anyone tell me the best way to do this? I have tried the following but not sure it is working:
var xx = new GlideRecord('table');
xx.addQuery('u_requested_item', g_form.getValue('sys_id');
xx.addQuery('fieldname');
xx.query();
while (xx.next()) {
if (fieldname != '' && fieldname != null && action != 'close_task') {
alert(message);
return false;
At this point I receive the alert but the task will still close. I want to prevent the task from closing until the 'fieldname' has been populated. Any feedback is greatly appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 06:42 AM
Hi,
There are two ways to do this.
You have to apply some BR on the "embedded list" table so that the fields will be mandatory
The other way is to have BR on the current form(with some condition on primary key defined between two tables) and abort the record if the condition is not satisfied.
Thanks,
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 08:46 AM
Hi,
Thanks again for you feedback. One more question. Do I create this BR on my table or the sc_task table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2014 08:52 AM
The 2nd line of your script is missing the closing parenthesis:
xx.addQuery('u_requested_item', g_form.getValue('sys_id');
should be:
xx.addQuery('u_requested_item', g_form.getValue('sys_id'));
Also you have to set a condition to return true.