how to copy Task skills related list values to a List type field in servicenow

Are Kaveri
Tera Contributor

Hello

 

 

I am working on The Case Form for CSM/FSM Configurable workspace.

On the Case table we have a related table called Task Skills (table)

I want to Task Skills to be added on the Case table Skills field which is a List type field

 

I tried updating the Dictionary and clicked Advanced view

Referencequal = javascript: 'active=true^skillsLIKE'+new x_sor_csmcase.CSMCaseUtils().getTaskSysID(current);

 

how to return the values in script include with comma separated values.

   getBrandSysID: function(csmCase) {

        var skills = '';
        var gr = new GlideRecord('task_m2m_skill_list');
        gr.addQuery('skill', csmCase.skills);
        gr.query();
        if (gr.next()) {
            skills = gr.getValue('sys_id');

        }
        return skills;

    },

 

I am not understanding how to achieve 

AreKaveri_0-1746181435865.pngAreKaveri_1-1746181535459.pngAreKaveri_2-1746181578889.png

Skills is field(present on Case table) for which i want to copy Task skills (related table) .

 

 

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Are Kaveri 

use this in advanced reference qualifier

javascript: var arr = [];
var gr = new GlideRecord("task_m2m_skill"); // give your table name
gr.addQuery("task", current.sys_id); // give your task field name
gr.query();
while (gr.next()) {
    arr.push(gr.skill.toString()); // give your skill field name
}
var query = 'sys_idIN' + arr.toString();
query;

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

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Are Kaveri 

use this in advanced reference qualifier

javascript: var arr = [];
var gr = new GlideRecord("task skills table"); // give your table name
gr.addQuery("task", current.sys_id); // give your task field name
gr.query();
while (gr.next()) {
    arr.push(gr.skill.toString()); // give your skill field name
}
var query = 'sys_idIN' + arr.toString();
query;

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Are Kaveri 

use this in advanced reference qualifier

javascript: var arr = [];
var gr = new GlideRecord("task_m2m_skill"); // give your table name
gr.addQuery("task", current.sys_id); // give your task field name
gr.query();
while (gr.next()) {
    arr.push(gr.skill.toString()); // give your skill field name
}
var query = 'sys_idIN' + arr.toString();
query;

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

@Are Kaveri 

Thank you for marking my response as helpful.

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

@Are Kaveri 

Hope you are doing good.

Did my reply answer your question?

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