Need help on script on record producer to create a record in table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 09:20 AM
Hi All,
Having a requirement that after submitting the record producer form, it has to create a record in the table.
tried with some script but not working, the record is not getting created on the table.
(function() {
var rowsInt = producer.u_serial_number.getRowCount();
//gs.log('Asset count : '+ rowsInt);
for(var i = 0; i < rowsInt; i++) {
var grIncident = new GlideRecord('cmdb_model');
grIncident.initialize();
grIncident.setValue('name', producer.name);
grIncident.setValue('manufacturer', producer.manufacturer);
grIncident.setValue('cmdb_model_category', producer.model.cmdb_model_category);
grIncident.setValue('u_model_sub_category', producer.model.u_model_sub_category);
grIncident.insert();
}
})();
need suggestions on the table.
Regards,
Vinod.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 09:31 AM
Hello Chanti,
What are you storing in u_serial_number variable on record producer? and what gs.log('Asset count : '+ rowsInt);
you can also apply the log inside for loop to see if the control goes inside for loop or not
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 09:32 AM
Hi,
The very definition of a Record producer, is that is produces a record. Here is seems you want to create multiple records after submitting this record producer form.
Could you explain what it is you are trying to do. It might be that a record producer is not the best choice for you.