- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2016 11:34 AM
Hi,
I would like to know how to get the current element/record in a glideRecord query.
Here is my current script:
The
gr.x_prgm_red_team_te_u_integer_1 -= 1;
part is decrementing all the records in gr which get returned from the query.
I want something like:
while(gr.hasNext()){
//conditional
if(gr.peekNext().x_prgm_red_team_te_u_integer_1 > currOrder){
//decrement only the specific record gr.next is on, not every record in gr
gr.next().x_prgm_red_team_te_u_integer_1 -= 1;
}
}
hence my conditional.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2016 02:00 PM
//grab the other records in the table x_prgm_red_team_test_app_request
var gr= new GlideRecord('x_prgm_red_team_test_app_request');
gr.addQuery('sys_id','!=',current.getValue('sys_id'));
gr.addQuery('state','1');
gr.query();
//decrement the orders for each of the other records if it is > currOrder
while(gr.next()){
//only decrement the order for the record if it is > currOrder
if(gr.x_prgm_red_team_te_u_integer_1 > current.x_prgm_red_team_te_u_integer_1){
gr.x_prgm_red_team_te_u_integer_1 -= 1; //decrement
gr.update();
}
}
//reset the priority order for the current record to blank
current.x_prgm_red_team_te_u_integer_1 = '';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2016 02:00 PM
//grab the other records in the table x_prgm_red_team_test_app_request
var gr= new GlideRecord('x_prgm_red_team_test_app_request');
gr.addQuery('sys_id','!=',current.getValue('sys_id'));
gr.addQuery('state','1');
gr.query();
//decrement the orders for each of the other records if it is > currOrder
while(gr.next()){
//only decrement the order for the record if it is > currOrder
if(gr.x_prgm_red_team_te_u_integer_1 > current.x_prgm_red_team_te_u_integer_1){
gr.x_prgm_red_team_te_u_integer_1 -= 1; //decrement
gr.update();
}
}
//reset the priority order for the current record to blank
current.x_prgm_red_team_te_u_integer_1 = '';