Display related record numbers that has the reference value selected in the portal

ss123
Tera Contributor

I want to display the record numbers that has the reference value selected.

For example: 

When a "Key Matter Number" is selected, I want to display the record numbers in the Portal that have this Key Matter Number from the table record.

ss123_0-1740452170564.png

In the table, there are 3 records that has the "Key Matter Number" selected and I want these record numbers to be displayed in the Portal.

ss123_1-1740452290652.png

 

Is this possible?

 

Thank you.

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ss123 

you can use onChange catalog client script and GlideAjax and then bring the DEAL number and populate in single line text variable

OR

you can also use getReference with callback

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }

    if (newValue == '') {
        g_form.clearValue('dealVariable'); // location variable name here
    }

    var ref = g_form.getReference('u_keyMattervariable', callBackMethod); // variable name
}

function callBackMethod(ref) {
    if (ref.number)
        g_form.setValue('dealVariable', ref.number); // your variable name & field here
}

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

6 REPLIES 6

Swapna Abburi
Mega Sage
Mega Sage

Hi @ss123 

Is it a catalog item that you want to display Deal Collection records after selecting a value in 'Key Matter Number' variable? if yes, in which type of variable you are trying to display Deal Collection record numbers?

 

If it is not a catalog item, are you referring to a Portal page and widget? if yes, you can write a simple JavaScript in Server script of widget and use the data object in HTML section.

Hi @Swapna Abburi 

Yes it's a catalog item. The Deal Collection record numbers related to the selected Key Matter Number should be displayed under "Key Matter Number" field.

ss123_0-1740457952849.png

 

Ankur Bawiskar
Tera Patron
Tera Patron

@ss123 

you can use onChange catalog client script and GlideAjax and then bring the DEAL number and populate in single line text variable

OR

you can also use getReference with callback

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }

    if (newValue == '') {
        g_form.clearValue('dealVariable'); // location variable name here
    }

    var ref = g_form.getReference('u_keyMattervariable', callBackMethod); // variable name
}

function callBackMethod(ref) {
    if (ref.number)
        g_form.setValue('dealVariable', ref.number); // your variable name & field here
}

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

Thank you @Ankur Bawiskar . I will try your suggestion.