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

Reference Qualifier

Mark Wood
Tera Contributor

Hello Experts,

I have created below reference qualifier for the alm_asset table but the reference qualifier is not working I have attached a screenshot of it Please guide why it's not working.

thank you.

1 ACCEPTED SOLUTION

Aniket Chavan
Tera Sage
Tera Sage

Hello @Mark Wood 

You can also use the script include and call that script include inside the variable in reference qualifier.
You can refer the below code:
Script Include:

 

var AssetFilterUtil = Class.create();
AssetFilterUtil.prototype = {
    initialize: function() {},

    getFilteredAssets: function() {
        var requestedFor = current.variables.requested_for;
        gs.log("REQ FOR - " + requestedFor);
        var assetIds = [];
        var arrayUtil = new ArrayUtil();

        var assetGr = new GlideRecord('alm_asset');
        assetGr.addQuery('assigned_to', requestedFor);
       // assetGr.addEncodedQuery('sys_class_name=alm_hardware^ORsys_class_name=alm_consumable^install_statusNOT IN7');
        assetGr.addQuery('sys_class_name', 'IN', ['alm_hardware', 'alm_consumable']);
        assetGr.addQuery('install_status', 'NOT IN', [7, 8]);
        assetGr.addQuery('state', 'NOT', 'retired');
        assetGr.query();

        while (assetGr.next()) {
            gs.log("Inside while");

            assetIds.push(assetGr.sys_id.toString());
        }

        return 'sys_idIN' + arrayUtil.unique(assetIds).join(',');
    },

    type: 'AssetFilterUtil'
};

 

Reference Qualifier:

 

javascript: new AssetFilterUtil(). getFilteredAssets();

 

AniketChavan_0-1703068305416.pngAniketChavan_1-1703068332788.png

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Regards,

Aniket

View solution in original post

13 REPLIES 13

ersureshbe
Giga Sage
Giga Sage

Hi, when you want to troubleshoot the reference qualifier you should use background or Fix script with a simple alert message. If the code has the current. field_name assignment you should check with Business Rule with a simple alert message again.

Regards,
Suresh.

Anil Lande
Kilo Patron

Hi,

I would suggest to share your reference qualifier script as a text instead of screenshot. It is easy for us to copy and test. Also to suggest modifications by updating your script.

Please share your script using script editor or in text format.

 

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hello @Anil Lande next time I will take care of it The issue is resolved thank you.

Danish Bhairag2
Tera Sage

Hi @Mark Wood ,

 

Could you mark the response as Solution Accepted whichever response helped you n close the thread it will help other users to find the right info.

 

Thanks,

Danish