How to write a script using script include to autosave the data upon clicking button in ServiceNow.

Rashmi N
Tera Contributor

Hi,

 

I have a requirement ,

1.Created one button using UI Action called "Approve RITM" on the RITM form. it wis working fine. 

2.But before clicking that button, If I am adding anything on the form/changing any data, it is not saving that data.

 

So my question is If I am clicking the Approve button the data also should save whatever data I am adding on the form  and RITM also should approve. 

 

I have created the script include in the UI Action button, I will share the screenshot of my code, Please let me know what else needs to be added for saving the data along with Approval. Please find the below attached screenshot of my code.

 

Thanks

2 REPLIES 2

Rashmi N
Tera Contributor

RashmiN_0-1722254171775.png

 

Hi,

The code is only updating approval record not the RITM record.

Use current.update() in server script of UI action to save other changes as well