- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 08:38 AM
The goal of my UI action is to copy some fields from a demand record to a custom table called test . It also updates a field on the current demand record with a reference to the newly created record.
The fields are copied over , and the field on demand is being updated with a reference to the new record on test . However , on click its creating two records in the test table . One that's completely blank and one with the values.
I believe the issue is because I'm using current.update() and gr1.insert() together , but I haven't figured out how to get the UI action to work as intended without them.
var gr1 = new GlideRecord('u_test');
var chgSysId = gr1.insert();
current.u_test_r1_number = chgSysId ;
current.update();
gr1.initialize();
gr1.u_demand_number_reference =current.sys_id;
gr1.u_assigned_lead = current.u_assigned_lead;
gr1.u_intake_decision_note = current.u_intake_note;
gr1.u_request_name = current.short_description;
gr1.u_client_name= current.u_client_name;
gr1.u_test_request_type="review1";
gr1.u_crm_lead= current.u_brm_lead;
gr1.u_request_status ="draft";
gr1.insert();
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 08:41 AM
Hi
the following two lines make no sense
var gr1 = new GlideRecord('u_test');
var chgSysId = gr1.insert();
What is your intention by inserting a blank record into 'u_test' ?
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2022 09:20 AM
Thanks for your help