The CreatorCon Call for Content is officially open! Get started here.

How to create a Reference qualifier in catalog item?

pverni
Tera Contributor

Hello,

 

I'm trying to configure a reference qualifier inside a catalog item variable. 

So, in my use case I have 4 choice question reference to sn_risk_definition. The first one is my N0 Risk Statement and the others are N1, N2 and N3. My idea is create an reference quelifier filter that  makes the N1 records appers if the N0 is the parent.

 

pverni_0-1759870112842.png

In the N1, I used this code: 

javascript:new catalogGetRiskDefinitions().getRisks(taxonomia_de_risco_n0)

 And I created this script include:

var catalogGetRiskDefinitions = Class.create();
catalogGetRiskDefinitions.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getRisks: function(parentId) {
        var ids = [];
        var gr = new GlideRecord('sn_risk_definition');
        gr.addQuery('parent', parentId);
        gr.query();
        while (gr.next()) {
            ids.push(gr.sys_id.toString());
        }
        return 'sys_idIN' + ids;
    },

    type: 'catalogGetRiskDefinitions'
});

 But thats not work.

Can anyone help me in this case?

 

Thanks!

 

Pedro Verni

1 ACCEPTED SOLUTION

Rafael Batistot
Kilo Patron

Hi @pverni 

 

Try use this reference qualifier whitout script include 

 

javascript: "parent=" + current.variables.taxonomia_de_risco_n0


https://www.servicenow.com/community/developer-forum/reference-qualifier-on-a-reference-field-based-...

 

View solution in original post

3 REPLIES 3

Rafael Batistot
Kilo Patron

Hi @pverni 

 

Try use this reference qualifier whitout script include 

 

javascript: "parent=" + current.variables.taxonomia_de_risco_n0


https://www.servicenow.com/community/developer-forum/reference-qualifier-on-a-reference-field-based-...

 

Hello Rafael,

 

I tried this reference qualifier but the result is:

pverni_0-1759879247115.png

If I not select N0, the N1 field show every record in sn_risk_definition table. But, when I select one option in N0 field that have child record, N1 field show nothing.

In the exemple, I'm showing the Risk Statement record that I selected in first printscreen. In this case, when I select "Segurança Cibernetica" in N0, the N1 field should show this options bellow.

pverni_1-1759879430757.png

Did you know what I can do to fix this?

 

Thanks!

pverni
Tera Contributor

Hello Rafael,

 

Thanks for your help, I was able to achieve my goal. 

 

The problem was that I used choice/dropdown insted choice/record reference. Now its working.