Inserting multiple records at once.

ServiceNowSteve
Giga Guru

Good Morning All,

This is a repost from one I made last night but didn't get a reply on so I am hoping the morning shift may be able to help.

I am working with the m2m_sp_status_subscription table and I have a question I hope you may be able to help with.

What I want to do when creating a new record on that table is have two form fields.

Field #1 - Reference Field pointing to our user table
Field #2 - A list pointing to a table of services we offer.

The object of the record is to match a user with a service which I can do on a 1:1 match. Now I need to make it so I can select multiple services and one user then when I save or submit the record I would like it to do a while loop through the list and insert a new record for that user and that service.

My issue is that I am not sure how to change the save and update buttons on the record form to do that loop through each item logic since ave and Update are global UI actions.

Any ideas how I might accomplish this?

 

find_real_file.png

6 REPLIES 6

Thanks again for the information, it still seems to save but as a single record and I think that I might not be explaining correctly what I am attempting so hopefully this will help clarify a little more.

 

find_real_file.png

Ricardo Velez
ServiceNow Employee
ServiceNow Employee

Hi Steven,

 

Please review the following Doc:

 

https://docs.servicenow.com/bundle/jakarta-platform-administration/page/administer/list-administration/task/t_OverrideOrRmvAUIActionForExtTbl.html

 

It will show you the steps to overriding a global UI Action. They are pretty simple as all needed is to ensure that you create a new UI Action with the same 'Name' and 'Action Name' as the global UI Action. Ensure that you set the table field as well to the form you wish to override the OOB Save / Update functionality. 

 

In regards to looping through the field and inserting new records, this may require that you use a mixture of client side script to acquire the field value and a script include to do the calculation / inserts as needed on the server side. (GlideAjax API will be required for this).

Hopefully this helps in your inquiry.

 

Best regards,
Ricardo Velez | Senior Technical Support Engineer
ServiceNow | The Enterprise Cloud Company