- 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 02:16 AM
Hi @NAIDILE S
As this is OOTB Child Parent relationship, when you try to create new Control Objective record using "New" button on related list, it should automatically take your current record as parent and after creating new record, it gets mapped as the Child record of the Current Control Objective record.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-08-2023 02:20 AM
Hi @AnubhavRitolia
Thats crt,
But is there a way to populate the field value to child one?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-08-2023 02:20 AM
Hi @NAIDILE S
I guess you want to Auto-populate the Child Field values from Parent Field values, so you can use onLoad Client script on Control Objective table.
Condition: Parent field is not empty and parent.sys_class_name='<control_objective_table_name>'.
Now you have to use GlideAjax in your script where you have to pass your Parent field value which is Parent Control Objective record. In your Script Include you can get the respective parent Control Objective record and return all desired field values in the form of JSON.
In your Client Script you can part JSON and populate your field values respectively.
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-08-2023 02:28 AM
@AnubhavRitolia
Thank you for this approach, do u have any reference document? It will be helpful