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

Dynamic Assigned to Visual Task Boards

jwagner
Tera Contributor

ServiceNow Friends,

We have been able to create task boards on an individual basis. We'd like to have a visual task board exist in the application menu and display results dynamically based on "assigned to". We can create the board we need, but don't want to create individually for each user.

Thanks,

Jeremy

1 ACCEPTED SOLUTION

LaurentChicoine
Tera Guru

Hi Jeremy,



This is a nice idea.



Here is how to do it (I made it in Istanbul so not sure about the compatibility with older versions, differences should only be in the creation of the task board):



1. Create a processor that will create the board if the user does not already have a visual task board for his tasks or if the user already has a board then we will redirect him to that board. The board sys_id will be stored as a user preference of the user.



Name: VTBTasksAssignedToMe


Type: script


Path: vtb_tasks_assigned_to_me


Script:


(function process(g_request, g_response, g_processor) {



      var vtbId = gs.getPreference('vtb.assigned.to.me');


      var vtbGr = new GlideRecord('vtb_board');


     


      if(!vtbId || !vtbGr.get(vtbId)){


              vtbGr = new GlideRecord('vtb_board');


              vtbGr.initialize();


              vtbGr.name = gs.getMessage('Tasks assigned to me');


              vtbGr.owner = gs.getUserID();


              vtbGr.table = 'task';


              vtbGr.filter = 'assigned_toDYNAMIC90d1921e5f510100a9ad2572f2b477fe';


              vtbGr.field = '__KANBAN__';


              vtbGr.card_limit = 1000;


              vtbGr.stream_limit = 50;


              vtbGr.show_list_toggle = true;


              vtbGr.background_color = 'vtb-board-color-1';


              vtbId = vtbGr.insert();


             


              //If using field kanban which is the default lanes we must create these lanes


              if(vtbGr.field == '__KANBAN__'){


                      var lanes = [gs.getMessage('To Do'), gs.getMessage('Doing'), gs.getMessage('Done')];


                     


                      lanes.forEach(function(lane, index){


                              var laneGr = new GlideRecord('vtb_lane');


                              laneGr.initialize();


                              laneGr.board = vtbId;


                              laneGr.name = lane;


                              laneGr.order = index;


                              laneGr.insert();


                      });


                     


              }


             


              //Setting the user prefrence


              gs.getUser().setPreference('vtb.assigned.to.me', vtbId);


      }


     


      g_processor.redirect('$vtb.do?sysparm_board=' + vtbId);



})(g_request, g_response, g_processor);



You can customize the script to change the default values. The filter is an encoded query, you might want to modify it, let's say to add "^active=true".



If you have different needs for that type of Visual Task board generated from a menu you might want to make this processor more scalable by adding parameters. I made it quickly to show the functionality.



2. Create a module to make this processor run



Title: Visual Task Board - Assigned to me (you can give another title if you want)


Application Menu: Choose what you want


Link type: URL (from Arguments:)


Arguments: vtb_tasks_assigned_to_me.do


Roles: If you want to limit the use to a specific role (ex: itil)



3. Create ACL for that processor (Only if you chose to limit the use to the specific role)



Type: processor


Name: VTBTasksAssignedToMe


Requires role: Role(s) you selected for the module



I hope this helps you, don't hesitate if you have any question.


View solution in original post

16 REPLIES 16

_willians
ServiceNow Employee
ServiceNow Employee

You can use the Flow Designer to automate this task easily. Create a Flow to run every time you have an inclusion of a member of a group and add it to the VTB. Like the following example.

 

find_real_file.png

 

 

alkajefry063
Kilo Explorer

i have these best Crokinole game accessories, i guess this will work fine for me to have this problem solved