- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 09:08 PM
Hi Guys,
I know what they mean in theory but I am trying to find a working example of the usage of sysparm_offset and sysparm_limit? Does anybody have one?
Mussie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 09:46 PM
Hi Mussie,
Those parameters have some meaning only for table apis. Out of the the box API's. In case if you are implementing a Scripted Web Service, You can choose to have different parameter names to achieve the same.
GlideRecord API has below method which you can use to achieve the same behaviour. Grab those parameters and pass it to below function
chooseWindow(Number f, Number l, Boolean forceCount)
Sets a range of rows to be returned by subsequent queries.
Parameters:
- f - (Number) the first row to include.
- l - (Number) the last row to include.
- forceCount - (Boolean) if true the getRowCount() method will return all possible records.
Returns:
- void
Example:
var gr = new GlideRecord('incident'); gr.orderBy('number'); gr.chooseWindow(2, 4); gr.query(); if (gr.next()) { gs.info(gr.number + ' is within window'); } Output: INC0000002 is within window |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 09:15 PM
Hi ,
Check it
http://wiki.servicenow.com/index.php?title=Table_API#Methods
Using REST API with Servicenow
it will help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 09:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 09:32 PM
Thank you both for your responses. Yes, I have already seen these pages, I already have a scripted rest api which pulls records from ServiceNow table and what I am after is, where do I stick these parameters?
Mussie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2016 09:46 PM
Hi Mussie,
Those parameters have some meaning only for table apis. Out of the the box API's. In case if you are implementing a Scripted Web Service, You can choose to have different parameter names to achieve the same.
GlideRecord API has below method which you can use to achieve the same behaviour. Grab those parameters and pass it to below function
chooseWindow(Number f, Number l, Boolean forceCount)
Sets a range of rows to be returned by subsequent queries.
Parameters:
- f - (Number) the first row to include.
- l - (Number) the last row to include.
- forceCount - (Boolean) if true the getRowCount() method will return all possible records.
Returns:
- void
Example:
var gr = new GlideRecord('incident'); gr.orderBy('number'); gr.chooseWindow(2, 4); gr.query(); if (gr.next()) { gs.info(gr.number + ' is within window'); } Output: INC0000002 is within window |