Setting list module fixed query with script include

Al_Andrea
Tera Expert

Hi.

 

I need to apply a fixed (preferrably) query to a module that displays a list of records in a scoped application.

Is it possible use a script include to build the query of a module?

I've seen on the instance some OOTB cases in which this was done with a module of type List of record with a script include call in the arguments but I haven't been able to do it myself.

Has someone done this before or is there another solution?

I could do this with a before query business rule but I would rather not.

 

This is the code in the script include to build the query.

getCurrentUserGroups: function() {
        var groups = [];
        var grGroupMember = new GlideRecord("sys_user_grmember");
        grGroupMember.addEncodedQuery("user=" + gs.getUserID() + "^group.nameSTARTSWITHmy group prefix");
        grGroupMember.query();
        while (grGroupMember.next()) {
            groups.push(grGroupMember.group());
        }
        return groups.toString();
    },

    filterForGroups: function() {
		var groups = this.getCurrentUserGroups();
        return "assignment_groupIN" + groups;
    },

I know there is a Dynamic filter for the user's groups but that adds every group to the query not only the application ones. 

 

In the module I have tried to invoke this script inlcude with every kind of syntax but I wasn't able to execute it.

1 ACCEPTED SOLUTION

Al_Andrea
Tera Expert

After checking the "Snadbox enabled" checkbox on my client callable script include record I was able to succesfully use it in the module.

View solution in original post

5 REPLIES 5

Al_Andrea
Tera Expert

After checking the "Snadbox enabled" checkbox on my client callable script include record I was able to succesfully use it in the module.