- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2014 02:54 PM
I have created a custom table and am attempting to use it on an Inbound Email Action. I have run into a problem however in using GlideRecord to query the table. What is happening is that I will issue a Query and get the expected number of rows back as seen by .getRowCount(). I can issue a .next() to the query and access the first record returned without issue. However from this point on it does not believe there are any more records. If I run .hasNext() it returns false and if I try to use .nex() nothing changes.
This is my first foray into custom tables so I'm not sure if I missed some specific field needed to allow queries to properly work. The table does not extend anything and has one reference. Other than that it has the default values, 2 choice lists and the rest are strings. If I change the sorting parameters I can alter which record is first without issue and using the same code I can put in an existing table and navigate the records without issue. The table is extensible right now and autonumbered.
Any help would be greatly appreciated. Here is the code I'm using, ignore that it is using a count instead of having .next() in the while loop, it is setup this way from debugging this issue.
var lookup = new GlideRecord('u_failed_event_rules'); lookup.query(); var count = lookup.getRowCount(); logger.logInfo('row count ' + count) while (i < count){ logger.logInfo('has next ' + lookup.hasNext()); lookup.next(); logger.logInfo('query details ' + ' policy ' + lookup.u_policy.toString() + ' client ' + lookup.u_client + ' label ' + lookup.u_schedule_label + ' type ' + lookup.u_schedule_type); }
In the logging you can see this from the logger statements( note that the 3 query details should all be different):
row count 3
has next true
has next false
has next false
query details policy SQL_NJTOSQLC03_Daily client njtosqlc03 label TEST2 type FULL
query details policy SQL_NJTOSQLC03_Daily client njtosqlc03 label TEST2 type FULL
query details policy SQL_NJTOSQLC03_Daily client njtosqlc03 label TEST2 type FULL
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2014 07:19 AM
I was able to solve it, the solution makes absolutely no sense to me but it is working.
All I did was change my variable for the query from 'lookup' to 'gr' and now it works. No logic changes at all were made.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2014 07:35 AM
That is definitely weird.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2014 07:59 AM
It may be that there is a reserved object or variable of the same name; lookup. It's commonly used.