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

amlanpal
Kilo Sage

Hi,



Could you please provide the details with screenshot? Do you mean to say that you have to update/insert a record via one UI Action?


Kiddy1
Tera Contributor

we have a mapping functionality where two fields are mapped and updated accordingly in the table,when we click process button a new record should be created


and it should be placed in the related list we get the real data from the another tool,my query is when we click on process button it should create new record and the form should refresh and stay in the current page the above two fields should be emptied and the related list should be updatedcapture10.PNG


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


Vasu1
Mega Contributor

Hi Amlan,

As per your reply the action.setRedirectURL(current); 

I tried on user story form(rm_story) it goes to new page instead of staying on same page.

 

Best,

Sri