- 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 04:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 04:07 AM
Hi,
if you are clicking new button from the related list of any form that parameter should be there
that would help you identify if record is being created from normal table list or from related list
did you add alert for url? what came
can you share the complete one?
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 04:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2022 04:16 AM
Hi,
it should contain that parameter
Did you check for some other table?
You are on incident form and click on New button for incident task in related list; you should see that
Is this because you customized the New button on that related list table?
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 04:22 AM
I was customizing copy of OOTB "new" ui action but now I completely removed it and I'm using regular "New" ui action on that related list. This parameter is there but not in the moment when client script runs but a while after.
I quickly changed this client script to incident_task and it url doesn't contain this parameter either: