Auto populate fields through UI Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2018 04:32 AM
Parent Table parameters passing to child table through UI Action(Without Child Record Insert passing through URL ).
- Test Plan (Parent table) 2 fields Short description and instructions are Auto Map to Defects (Child table) fields Short description and description.
UI Action:
Name:My Defect
Table:Test Plan[tm_test_plan]
Form Button:True
On click:open_defect();
Script:
function open_defect(){
var shortdesc = g_form.getValue("short_description");
var instructions = g_form.getValue("instructions");
var URL = "/nav_to.do?uri=rm_defect.do?sys_id=-1%26sysparm_query=short_description="+shortdesc+"^description="+instructions;
top.location.href= URL;
}
- If click on my defect button its Auto populate 2 fields to without Insert child record .
Thanks,
Srinath Patel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2018 06:00 AM
I wouldn't use a client script do this. I don't see any need for it based on your example, but I don't have all the requirements. When possible, keep your UI actions server side. Something like this (warning, untested code).
var shortdesc = current.getValue("short_description");
var instructions = current.getValue("instructions");
var URL = "rm_defect.do?sys_id=-1&sysparm_query=short_description="+shortdesc+"^description="+instructions;
var enc = GlideStringUtil.urlEncode(URL);
action.setRedirectURL(enc);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2021 09:32 AM
When creating a new record in incident table, If the record number matches with the existing records in incident table, and when we click on the UI action button, the form should be auto filled with the values in the matched incident record. So, how can we achieve this. Any clues....?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2023 03:28 AM
Hi Chuck,
In this same method, how do I populate a field which is not the in the form? for eg: 'parent' field of Incident.
And the rest of the condition remains the same (I dont want the form to be saved).
Best Regards,
Swarnadeep Nandy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2020 10:03 PM
Hi srinathpatel,
Try below script in UI action on server side.
var gr = new GlideRecord('defect_table');
gr.initialise();
gr.description = current.instruction;
gr.short_description = current.short_description;
gr.insert();
action.setRedirectURL(current);
I hope it also help you.
Thanks and Regards,
Kunal.