creating a new record when ui action button is clicked?

Kiddy1
Tera Contributor

i have a related list and the fields of the same table above when i click on button a new record should be created and related list has to be updated

can you please help with the code

explorenowamlanpalshloke04

1 ACCEPTED SOLUTION

Hi,



It gets more clarity now to me. So you want to get redirected back to the form after a new record is created via clicking on the Process UI Action. If this is what you are looking for, please use this line at the end of the Server Side code in your 'Process' UI Action: action.setRedirectURL(current);


The above line will help you to redirect to the current form once all the Script is being executed. For more details in understanding please refer: UI Actions - ServiceNow Wiki



I hope this helps. Please mark correct/helpful based on impact


View solution in original post

8 REPLIES 8

Just wanted to check, the related list table is same table where you are creating the new record?


yes


Hello kiddy,



You can follow the amlanpal suggestion and it should work, as per your requirement you just need to redirect to same page and then created record should reflect in your related list. Since related list table is the same one on which you are creating records so it should reflect there.


sach1
Tera Guru

user current.insert to create new record and setRedirectURL for redirecting on same page.