Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

UI Actions Scripting help

Khalid9030
Tera Contributor

Hi,

I have created Submit button in scoped application for one table when we click on the submit need to update the field for that I have written as given below and it should be redirect to list view of that table and please let me know the which I have written as per the best practices or not if not, please correct my code. 

 

current.u_draft = false;

current.update();

 

Thanks in advance. 

1 ACCEPTED SOLUTION

Yashsvi
Kilo Sage

Hi @Khalid9030,

please check below script:

// Update the field 'u_draft' to false for the current record
current.u_draft = false;
current.update();

// Redirect to the list view of the table
action.setRedirectURL('/table_name.do');

Thank you, please make helpful if you accept the solution. 

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

Hi @Khalid9030 ,

I tried your problem in my PDI and it works for you can add one line 

action.setRedirectURL('/incident_list.do'); This will redirect you to list view of incident table, you can give any table name and followed by _list.do in end.
SarthakKashyap_0-1720508580025.pngSarthakKashyap_1-1720508601521.png

 

When I click it came to list view

SarthakKashyap_2-1720508631744.png

 

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards 

Sarthak