Update & Next UI action

Mike Insley
Kilo Expert

Hi, 

 

I've a customer requirement to add an Update & Next UI Action to a form, so that the user is able to select the desired state in a record then update and move to the next record in one click. 

Completing the Update part isn't a problem as I've recycled the Update button on Task, however I'm having problems getting it to move to the next record after updating. 

Has anyone had any experience of doing this, or would anyone know how I'd go about scripting the 'open next record' part. 

Thanks in advance.

Mike

1 ACCEPTED SOLUTION

Karishma5
Tera Expert

Hi mikeinsleytu,

 

Try this script for "next" UI Action button.

 

var gr= new GlideRecord("<Your table name>");
gr.addQuery("number",'>',current.number);
gr.query();
gr.next();
current.update();
action.setRedirectURL(gr);

 

View solution in original post

3 REPLIES 3

Karishma5
Tera Expert

Hi mikeinsleytu,

 

Try this script for "next" UI Action button.

 

var gr= new GlideRecord("<Your table name>");
gr.addQuery("number",'>',current.number);
gr.query();
gr.next();
current.update();
action.setRedirectURL(gr);

 

HI Karishma,

Thanks for that, it worked great. Here's what I did:

var gr = new GlideRecord('<table name>);
gr.addQuery("number" , '>' , current.number);
gr.addQuery('active' , true);
gr.orderBy('number');
gr.query();
gr.next();
current.update();
action.setRedirectURL(gr);

 

I also added the conditions from the OOTB Update ui action, mainly because updating the current record needs to preform in the same way.

 

current.isValidRecord() && current.canWrite() && gs.getProperty('glide.ui.update_is_submit') != 'true'

James160
Mega Guru

Hi team

As the list from where you open a form may have filter conditions.

So the next record would not be simply number +1.

Any advise for such case?