Auto-populate fields from Parent Knowledge Category

maryamalona
Tera Contributor

Hi Team,

I have added two custom fields to the Knowledge Category table:

  • u_manager
  • u_reviewers

My requirement is that when a user clicks New Category, the Manager and Reviewers fields should automatically populate with the values from the parent category.

I attempted to achieve this using the following onLoad Client Script:

 
 
function onLoad() {
   var parentId = g_form.getValue('parent_id');
   if (!parentId) {
       return;
   }
   g_form.getReference('parent_id', function(parent) {
       if (!parent || !parent.sys_id) {
           return;
       }
       g_form.setValue(
           'u_reviewers',
           parent.u_reviewers
       );
       g_form.setValue(
           'u_manager',
           parent.u_manager
       );
   });
}
 

However, this is not working as expected.

Could you please advise on the best approach to:

  1. Retrieve the u_manager and u_reviewers values from the selected parent category.
  2. Automatically populate these fields on the new category record.
  3. Determine whether a Client Script, Business Rule, or another method would be more appropriate for this requirement.

Any guidance or sample implementation would be greatly appreciated.

Thank you.

0 REPLIES 0