Skip to content

Instantly share code, notes, and snippets.

@kcimpulse
Created May 19, 2017 16:44
Show Gist options
  • Save kcimpulse/c16dd028b5681aabb5c62cf7251a0ecf to your computer and use it in GitHub Desktop.
Save kcimpulse/c16dd028b5681aabb5c62cf7251a0ecf to your computer and use it in GitHub Desktop.

Revisions

  1. kcimpulse created this gist May 19, 2017.
    23 changes: 23 additions & 0 deletions BackfillAssignmentGroup.SI
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    var BackfillAssignmentGroup = Class.create();
    BackfillAssignmentGroup.prototype = {
    initialize: function() {
    }, BackfillAssignmentGroup:function() {
    var gp = [];
    var a = current.assigned_to; //sys_user_grmember has the user to group relationship
    var grp = new GlideRecord('sys_user_grmember');
    if(a){
    grp.addQuery('user',a);
    }
    grp.addEncodedQuery("group.typeLIKEcff624593854010072edffb4849a2c4a"); //Set to your Group SID Type to limit amount of Groups.
    grp.query();
    while (grp.next()) {
    gp.push(grp.getValue('group'));
    }
    // return Groups where assigned to is in those groups we use IN for lists
    return 'sys_idIN' + gp.join(',');
    },
    type: 'BackfillAssignmentGroup'
    };

    // Below is the Advanced Reference Qualifier for the Task Table Assignment Group Refrence Field - With No Attributes Needed.
    javascript:new BackfillAssignmentGroup().BackfillAssignmentGroup()