delegates module

Prasanth Alapat
Tera Contributor

Hi,

I need a module under inicidents application like 'my owner incidents' which should get incidents of my owner.

i.e, condition is ---if i am the delegate of user/users then i should get incidents of that user/users

1 ACCEPTED SOLUTION

Yes I believe it should work in scoped app as you are adding new records in a different scope. I just tried out on my instance and it was working in global scope. Please try these steps and let me know the results. You will have to modify the script calls based on scoped naming convention.



1) Create a client callable script include "FilterOwners" with script as



var FilterOwners = Class.create();


FilterOwners.prototype = {


  initialize: function() {


  },



  getMyOwners : function (){


  var answer = [];


  var gr = new GlideRecord("sys_user_delegate");


  gr.addEncodedQuery("ends>javascript:gs.daysAgoEnd(0)^delegate="+gs.getUserID());


  gr.query();


  while (gr.next()) {


  answer.push(gr.user.toString());


  }


  return answer;


  },



  type: 'FilterOwners'


};



2) Create a dynamic filter as shown on user table, mark available for filter and Script as new FilterOwners().getMyOwners()



Dynamic Filters.jpg



3) Go to incident list and try this filter, You can add the same filter in your module.



owners_1.jpg



owners_2.jpg



One more point to add, OOB there is a default dynamic filter called as One of my Assignments, this also runs on delegate table but only return those owners who are marked as assignments=true on delegate record.




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


View solution in original post

4 REPLIES 4

Alikutty A
Tera Sage

Hi,



You will need to create a new dynamic filter option and use it as the filter for your module.   The filter should return all of your owner delegates.



Create the filter on user table, you can use the OOB filter for 'One of My Assignments' can be referred.



Create a dynamic filter option



Create scripted filters





Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


Prasanth Alapat
Tera Contributor

but this has to done with scoped application


Yes I believe it should work in scoped app as you are adding new records in a different scope. I just tried out on my instance and it was working in global scope. Please try these steps and let me know the results. You will have to modify the script calls based on scoped naming convention.



1) Create a client callable script include "FilterOwners" with script as



var FilterOwners = Class.create();


FilterOwners.prototype = {


  initialize: function() {


  },



  getMyOwners : function (){


  var answer = [];


  var gr = new GlideRecord("sys_user_delegate");


  gr.addEncodedQuery("ends>javascript:gs.daysAgoEnd(0)^delegate="+gs.getUserID());


  gr.query();


  while (gr.next()) {


  answer.push(gr.user.toString());


  }


  return answer;


  },



  type: 'FilterOwners'


};



2) Create a dynamic filter as shown on user table, mark available for filter and Script as new FilterOwners().getMyOwners()



Dynamic Filters.jpg



3) Go to incident list and try this filter, You can add the same filter in your module.



owners_1.jpg



owners_2.jpg



One more point to add, OOB there is a default dynamic filter called as One of my Assignments, this also runs on delegate table but only return those owners who are marked as assignments=true on delegate record.




Thanks


Please Hit like, Helpful or Correct depending on the impact of the response


That was Awesome...Thanks!...