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

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. 

@Yashsvi 

 

@Yashsvi 

Thanks for your reply.

I have question, when we move this development to another environment . will this be dynamically changed to that environment ?  

action.setRedirectURL('/table_name.do') 

Community Alums
Not applicable

@Khalid9030 ,

On which table you want to redirect? I mean you redirect on OOB tables like Incident, problem, User than there is no issue but you have to redirect to custom table than you have to add that table in your new environment.

 

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

Thanks and Regards 

Sarthak

@Yashsvi  @Community Alums 

Could you please tell me is this best practice to use the custom submit button instead of OOB submit button in scoped app  table ? 

when i use the custom submit button the field is updating as per the script given above will this work like as global submit button ? I can see in the global submit button below script include is called 

 

answer = current.insert();
gs.include('ActionUtils');
var au = new ActionUtils();
au.postInsert(current);
 
i wanted to know what is purpose of it global submit button ? 
Please guide me