- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 02:37 AM
Hello experts,
I'm trying to create new record from related list and set some predefined values on the form. I copied "New" ui action:
in line 8 I'm trying to set value of audit field but after running this ui action I get info message saying "Record not found". What am I doing wrong?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 03:44 AM
Hi,
don't update OOB ui action
you can use onLoad client script or display business rule on that related list table and set the audit field
onLoad client script on that related list table
function onLoad(){
var url = top.location.href;
if(g_form.isNewRecord() && url.indexOf('sys_is_related_list=true') > -1){
g_form.setValue('audit', '18603524db7830509507a15505961943');
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 03:01 AM
Hi,
Remove line 8 and paste uri.set('sysparm_query','audit=18603524db7830509507a15505961943'); in line 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 03:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 03:34 AM
Try uri.set('sysparm_query','audit='+parent.audit);
uri.set('sysparm_query','audit='+parent.audit_field_name_parent_table);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 03:44 AM
Hi,
don't update OOB ui action
you can use onLoad client script or display business rule on that related list table and set the audit field
onLoad client script on that related list table
function onLoad(){
var url = top.location.href;
if(g_form.isNewRecord() && url.indexOf('sys_is_related_list=true') > -1){
g_form.setValue('audit', '18603524db7830509507a15505961943');
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader