- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-08-2023 02:02 AM
Hi
I have a requirement , where I have a table (Control Objective)- parent, and this table (Control Objective) has a related list in which there is same table Control objective - child...
so when i create a record from the related list (child record) , the fields should be auto filled for the child record..
How can i do it .
can anyone help me on this
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-08-2023 02:53 AM
you can use display business rule on the child table and use the parent field to auto-populate fields
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.parent){
current.fieldNameOnChild1 = current.parent.fieldName1;
current.fieldNameOnChild2 = current.parent.fieldName2;
}
})(current, previous);
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
ā11-08-2023 04:07 AM
@Ankur Bawiskar
Say if i update the existing record with the new parent, in this case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-08-2023 04:32 AM
in that case you will require before insert/update and same script
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-10-2023 06:02 AM
HI @Ankur Bawiskar
Can we use OnChange client script for the same ? If yes how can we achieve it .
I'm little stuck with this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-10-2023 06:03 AM
onChange will work when you change the field. you can then use GlideAjax
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-10-2023 06:15 AM
@Ankur Bawiskar
Ill try with GlideAjax then
thank you