- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I Want to populate my mrvs data from record producer to a table under a related list of a custom table form view.
I have created a custom table for the other fields to store the record producer data once submitted. And I have created child table with year, month, no_of_seats_require as same as MRVS fields, and parent field which is reference to custom table.
In the producer side I have used this code to initialize the record on the table mentioned:
this is not working and rows are not inserted in related list of custom table. How I can achieve this. Please provide the resolution.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
record producer is on which target table? Parent table?
If yes then why to write current.insert() when record will already be created when you submit record producer?
what debugging did you do in your script?
1) table name and parent field is correct?
2) fields you are trying to set are correct? is the field type matching against variable type?
3) variable names from MRVS are correct?
4) add gs.info() and see
If you are trying to set reference field from choice variable then it won't work
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
record producer is on which target table? Parent table?
If yes then why to write current.insert() when record will already be created when you submit record producer?
what debugging did you do in your script?
1) table name and parent field is correct?
2) fields you are trying to set are correct? is the field type matching against variable type?
3) variable names from MRVS are correct?
4) add gs.info() and see
If you are trying to set reference field from choice variable then it won't work
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
@JyothiD I didn't see anything in Accepted solution given.. so I guess you are not interested in our Answer .!!
Anyway all the best
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
unless you add logs you won't know what came and how are you mapping.
try this
(function executeProducerScript(current, producer) {
// Get MRVS JSON (internal name = monthly_seat_demand)
var raw = producer.monthly_seat_demand.toString();
if (!raw) return;
var rows = JSON.parse(raw); // Array of objects
for (var i = 0; i < rows.length; i++) {
var r = rows[i];
var gr = new GlideRecord('x_ggisu_seat_deman_seat_demand_mrvs');
gr.initialize();
gr.parent = current.sys_id; // reference field to parent
gr.u_year = r.year || ''; // use internal column names from MRVS
gr.u_month = r.month || '';
gr.seat_request = parseInt(r.no_of_seats_require, 10) || 0;
gr.insert();
}
})(current, producer);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader