List collector to show only the unique values returned from the script include ( remove the duplicate records)

Bhavana Reddy
Mega Guru

Hello Guys,

 

I have the List collector field, depending on the Opportunity i need to show only the Unique SVO No (display= true is set for this field in the table) please let me know how we can achieve this?

 

script include::

function QuoteDisplay(oppo) {
    gs.log("oppo:"+oppo);
    var oppo = new GlideRecord('x_784298_needit_sp_opportunity');
    oppo.get(this.getParameter('oppo'));
    var svoNo = [];
    var gr = new GlideAggregate('x_784298_needit_sp_sub_contract_test'); //GlideAggregate query
    gr.addAggregate('count'); 
    gr.groupBy('svo_no'); //Group aggregate by the 'os' field
    gr.addQuery('opportunity', oppo.sys_id);
    gr.query();
    while (gr.next()) {
        svoNo.push(gr.svo_no + '');
    
    }
    gs.log("svoNo arry::"+svoNo);
    return svoNo.toString();
}

in the reference qualifier, calling like this

find_real_file.png

For the selected Opportunity( in below screenshot ssss), i want to display the Unique quote associated to that in the list collector and it should show only the unique SVO No in the list collector

find_real_file.png

Can anyone please help me with this?

1 ACCEPTED SOLUTION

that's correct.

It's not possible

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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

View solution in original post

10 REPLIES 10

that's correct.

It's not possible

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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