Ownership group field is getting empty in the list view of knowledge article

shaik riyaz1
Tera Contributor

We have enabled 'Ownership group' field in the knowledge article to trigger approvals through flow designer.

For the use case, setting ownership group field when the 'configuration item(ci owner group value)' field changes using client scripts and script include.

Ownership group field value is visible on the form but not on the list view. we tried setting it through business rule(after insert,update) but the approvals are not triggering.

 

Client script: (on change of configuration item field)

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        var kb1 = g_form.getValue('kb_knowledge_base');
        if (kb1 == 'dfc19531bf2021003f07e2c1ac0739ab' || kb1 == 'f812dd214f62f24058c72ae6f110c72d' || kb1 == 'a7e8a78bff0221009b20ffffffffff17') {
            if (g_form.getValue('language') == 'English' && g_form.getValue('cmdb_ci') == '') {
                g_form.setValue('ownership_group', '');
            }
           

        }
    }

    //Type appropriate comment here, and begin script below
    var kb = g_form.getValue('kb_knowledge_base');
    if (kb == 'dfc19531bf2021003f07e2c1ac0739ab' || kb == 'f812dd214f62f24058c72ae6f110c72d' || kb == 'a7e8a78bff0221009b20ffffffffff17') {
        var gr = newValue;
        if (newValue) {
            var ga = new GlideAjax('populateOwnershipKB');
            ga.addParam('sysparm_name', 'getOwnerGroup');
            ga.addParam('sysparm_sysUserID', gr.toString());
            ga.getXML(callback);
        }
    }

    function callback(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");
        if (answer) {
            g_form.setValue('ownership_group', answer);
        } else {
            g_form.setValue('ownership_group', '');
        }
    }
}
 
 
 
Need help in setting the value on list view

 

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

@shaik riyaz1 

if you want this functionality to work on list view then you should use before update business rule

that's the only option

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Tried with before business rule still not setting the value.

 

current.ownership_group = current.cmdb_ci.support_group;

@shaik riyaz1 

it should work.

Are you sure BR is configured correctly and triggering?

share BR configuration screenshots.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

We tried with before and after business rules and it is not setting correctly.

Screenshot of After BR:

shaikriyaz1_0-1740565134996.png

 

shaikriyaz1_1-1740565163204.png

 

We also tried with script include but it is not working for new records.

Script include:

shaikriyaz1_2-1740565258082.png