Home Community Uploads
image

Cireson Partners, Customers and Community members share your customizations and examples here to help benefit the community as a whole to earn Kudos and badges.

DISCLAIMER

All files and projects located here are provided and come "as-is" and without any warranty or support. Use at your own risk. Your use of Community Uploads is subject to our Terms of Use.

Cireson does not and will not support or maintain these enhancements, extensions, and scripts.

For Team Cireson uploads click here.

Custom quick assign work item to me from grid

Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
You can often tell if a work item should be assigned to you but it isn't always the case that you will review it at the moment. Instead of open a work item and add yourself as an assigned user I've made a custom solution which adds a quick button to the grid in the Assigned User column.

Only present in 'Team Work' and 'Active Work' as it's where it makes most sense. Should you already be the assigned user the quick icon will not show.

Once clicked the logged on user will be the assigned user and there will be a record in the action log.


Currently only tested in my lab environment but seems to work with all browsers and supported work item types.

I've attached the files needed in a zip archive. To install just drop the files in CustomSpace (merge custom.js if you have other stuff there already!)

Comments

  • merlenette_jonesmerlenette_jones Member Advanced IT Monkey ✭✭✭
    @Martin_Blomgren you're a beast bro!
  • Adrian_MataiszAdrian_Mataisz Customer Advanced IT Monkey ✭✭✭
    wow. You are the best! Any way to add also an icon if and user commented last and no changes were made to the work item?
  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    @Adrian_Mataisz
    Everything is always possible (at least I like to believe :smile:). The problem here is to successfully determine if a change is made. One solution I could think of is, per work item in grid, get the object history and then evaluate if latest entry/change is by end user. The problem with this would be if you have a lot of work items and showing more than the default (10 per page) it would trigger many ajax api calls. And work items with a lot of history is of course generating a bigger payload. Will probably test it because I like the idea, it's an extension of the 'enduser responded' status which is set by a workflow in case of a comment. No promises though as to when and if!
  • Josh_GilliamJosh_Gilliam Customer IT Monkey ✭
    Would also be cool if you could Assign to Group from grid as well :smiley:

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    It's getting to the point where every time @Martin_Blomgren posts something, I have to start scheduling a Service Manager update.  :)
  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭
    @Martin_Blomgren   - Great Idea .

    I've tested in portal 7.2.2016.1 and as long as there is at least one entry already in the action log it works, but if there are no entries in the action log it doesn't return the "AppliesToTroubleTicket" or "AppliesToWorkItem" so there is nothing there to .push back to for the action log update.

    I changed
             if (workItemId.indexOf("IR") > -1 || workItemId.indexOf("PR") > -1) {
                    newData.AppliesToTroubleTicket.push(addToLog);
             } el.......
    to
            if (workItemId.indexOf("IR") > -1 || workItemId.indexOf("PR") > -1) {
                if ("AppliesToTroubleTicket" in newData) {
                    newData.AppliesToTroubleTicket.push(addToLog);
                }
             } el.......
    and this lets it assign the workitem to myself, always, but only adding an action log entry when there was already one there. so far i have not been able to get it to create the property for the action log (when there is no current entry there) to save it back to the workitem record :(

  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Along the same lines @Jeff_Lang is stating, the Service Requests in the grid seem to work just fine.  However, Incidents are failing even if there is an entry in the action log.  The newData.AppliesToTroubleTicket does not exist.  newData.nameRelationship[6] refers to that (I am sure the index varies by implementation), but .push() is not an available method.

    I took a few minutes to look at this, but do not have much time to pursue further today, unfortunately.  Hopefully this information is helpful to others, though.  This is a very convenient feature when it works and has inspired a few ideas for other similar functions.
  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    @Jeff_Lang, @Tom_Hendricks
    Can replicate this problems as well and are working on a fix as soon as I get the time!
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    Here's another one, but this time I can offer some help instead of just pointing out problems. :)

    There needs to be an entry for release records too, when setting the typeProjectionId.  Modification starting at line 83, which is the inclusion of an extra else between PR and RA, using the default RR type projection ID:

    // Get projection type id
        var projectionTypeId;
        if (workItemId.indexOf("IR") >= 0) {
        	projectionTypeId = "285cb0a2-f276-bccb-563e-bb721df7cdec";
        } else if (workItemId.indexOf("SR") >= 0) {
            projectionTypeId = "7ffc8bb7-2c2c-0bd9-bd37-2b463a0f1af7";
        } else if (workItemId.indexOf("CR") >= 0) {
            projectionTypeId = "4C8F4F06-4C8F-A1B6-C104-89CFB7B593FA";
        } else if (workItemId.indexOf("PR") >= 0) {
            projectionTypeId = "AA6D17AC-0ED8-5D86-D862-CFF4CD8792FA";
        } else if (workItemId.indexOf("RR") >= 0) {
        	projectionTypeId = "556e527e-893c-61fa-5663-49d9944fccbd";
        } else if (workItemId.indexOf("RA") >= 0) {
        	projectionTypeId = "3043253C-959E-25BD-32B4-C5EB1A7E71DC";
        } else if (workItemId.indexOf("MA") >= 0) {
        	projectionTypeId = "953BEAEE-ACF8-A195-363D-4782B2F919AC"
        }
    Tested and working in my environment for RR's in the grid.

    As for the Incidents, I need to walk back something I said above.  I am not sure what was happening yesterday, but now the assignment is working if there is at least one log entry.  AppliesToTroubleTicket is still undefined if there are no existing entries, though.
  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    @Jeff_Lang, @Tom_Hendricks, all other:
    We don't use release records and probably never will that's why I didn't even thought of those. Included the type id so it should work!

    When the action log is empty there is no property for neither AppliesToTroubleTicket nor AppliesToWorkItem and as the push() function is a prototype to an array object the function is not available. Added a check which if action log is missing add property and initialize as an empty array. And now it's working!

    <div>if (workItemId.indexOf("IR") > -1 || workItemId.indexOf("PR") > -1) {<br>&nbsp;&nbsp;&nbsp; if (!newData.AppliesToTroubleTicket) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newData.AppliesToTroubleTicket = [];<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; newData.AppliesToTroubleTicket.push(addToLog);<br id="null">} else if (workItemId.indexOf("SR") > -1 || workItemId.indexOf("CR") > -1) {<br>&nbsp;&nbsp;&nbsp; if (!newData.AppliesToWorkItem) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newData.AppliesToWorkItem = [];<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; newData.AppliesToWorkItem.push(addToLog);<br>}</div>

    Attached updated version!
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    I was able to sneak this in between meetings, and it seems to be working perfectly.

    We are also not using RR's in our processes, but I happened to have one in the grid because I am trying to sync with the PWA connector, and it is a requirement.  Otherwise, I would not have noticed either!
  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    Don't know if any of you ever noticed but I did when bringing this to production, this doesn't work with non-English locale settings, at least not when using Swedish.

    Fixed it so it should work regardless of locale settings. Please see attached updated version!
  • seth_coussensseth_coussens Member Ninja IT Monkey ✭✭✭✭
    @Martin_Blomgren
    Can I suggest you setup a github site and share that here? This would allow others to more easily find the latest version of the code you are providing as well as actually contribute to the project.

    While I'm not sure about performance or support ability of what you have here, it's pretty cool stuff! Thanks for your continued contributions!
  • Matt_Strachan1Matt_Strachan1 Member IT Monkey ✭
    I was able to get the icon to appear in the gridView but when I click the icon, I am getting an error: HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
    (XHR): GET - https://myURL/api/V3/Projection/GetProjection?Id=151. This seems like it is not sending the type project ion although I have verified the script is defining the typeProjectionId and the Id. Any idea why the API call would not be formatted correctly? Or has anyone had this and may know the solution?
  • Matt_Strachan1Matt_Strachan1 Member IT Monkey ✭
    I have actually stepped through the code and it seems that the var workItemId field needed to be reformatted and I added an additional .prev() to the line and now everything is working as expected. Here is the line I needed to update.


    // fired when user presses on assign to me button
    var AssignToMe = function(e) {
        // Get workitem Id
        var workItemId = $(e).parent().prev().prev().prev().prev().prev().text();
  • Martin_BlomgrenMartin_Blomgren Customer Ninja IT Monkey ✭✭✭✭
    @Matt_Strachan1, you are correct that the script assumes that the workitem id column is in a fixed position. You could change the script but you don't know whether the other analyst have changed their column ordering.

    I have an updated version which fetched the ID column index dynamically which we are using in prod without any problems. After my vacation I'll upload it (and all other stuff) to a GitHub repo and share it here!

  • Mark_GearyMark_Geary Customer IT Monkey ✭
    @Martin_Blomgren ,This works realy well and the team love it but they have asked if there is a way of having a second one so you can do the same thing but to a team and a difernt person in the same team?
  • Brad_McKennaBrad_McKenna Customer Advanced IT Monkey ✭✭✭
    @Martin_Blomgren Any chance we could get the newer version that dynamically fetches the ID column index?
  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭
    edited May 2018
    @Martin_Blomgren Any chance we could get the newer version that dynamically fetches the ID column index? :)
  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭
    It seems like this plugin does not work in the latest portal release.

    Move the "}" on line 34 to line 37/38 after the "assignToMeObserver.disconnect();


    Before:
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (titleElement.length > 0) { //An element with class of page_title exists.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var gridElement = $('[data-role=grid]') // Get the grid object<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (gridElement.length > 0) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddAssignEventHandlersOnGridDataSourceChange(gridElement);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //We are done observing.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assignToMeObserver.disconnect();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }

    After:

    &nbsp;&nbsp;&nbsp;            if (titleElement.length > 0) { //An element with class of page_title exists.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; var gridElement = $('[data-role=grid]') // Get the grid object<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (gridElement.length > 0) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddAssignEventHandlersOnGridDataSourceChange(gridElement);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                 //We are done observing.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                 assignToMeObserver.disconnect();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;              }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}

    Testet with portal 8.8.2.2016
  • Tom_HendricksTom_Hendricks Customer Super IT Monkey ✭✭✭✭✭
    @Mikkel_Madsen I did essentially the same change late last week and can confirm that it fixes it.  This is also true for the work item preview (the mutation observer is nearly identical), for exactly the same reason.
  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭
    I made the same change yesterday, and it also works for previous versions of the portal as well
  • Jakes_OosthuizenJakes_Oosthuizen Customer IT Monkey ✭

    hi guys


    can someone confirm if this works in Portal 9. Tried it, but no joy

  • Mikkel_MadsenMikkel_Madsen Customer Advanced IT Monkey ✭✭✭

    It works if you edit the code as described in my post from september 2018

  • Ryan_Kennedy1Ryan_Kennedy1 Customer IT Monkey ✭
    edited September 2020

    Hello, for those interested I have fixed a couple bugs that I have found in this script :

    • Workitem does not Assign To Me if workitem id is not exactly 4 columns to the left of the Assigned To field
    • If item gets assigned to you on a separate window / from a different user then you click Assign To Me before the grid refreshes it will actually unassign the workitem from you .. 

    I have added a couple features in there as well to allow you to Watch / Unwatch the workitem from the grid. If you don't want that then it can be toggled on / off on line 30 with true / false

    I've changed the location for the Assign To Me (and the new Watch / Unwatch) icons to be in the CustomSpace folder, just incase they get removed / moved around from the Cireson folder.

    I've renamed the file to AssignToMeWatchUnwatchInGrid as well.

    Just extract the zip in to your CustomSpace folder and load through custom.js

    Let me know what you think / any issues with it :)


    Thanks


  • Ryan_Kennedy1Ryan_Kennedy1 Customer IT Monkey ✭

    Sorry guys, just updated the attachment which had a bug in it ...

    The coding is probably a little dodgy but it definitely does the job!

  • AlaugonAlaugon Member IT Monkey ✭

    Hi all,

    Anyone has tested this on Portal V 9.4.5? We couldn't make it work.

  • Jeff_LangJeff_Lang Customer Ninja IT Monkey ✭✭✭✭

    While working on upgrading our portal to 11.6, i found this one had a few issues, so have modified it to work with 11.6.

    extra changes added

    variables to set where to load the icons it uses from

    variable to set if people can get an Unassign from me icon if the workitem is assigned to them. This will clear the assigned to if used. setting the variable "allowUnassigningFromMe" near the top of the script to true shows this icon , if set to false the icon does not display.


  • Donna_KennedyDonna_Kennedy Member IT Monkey ✭

    Hello,

    We have upgraded to 11.8 and I am trying to get this js to work. I had previously used the AssignToMe in a very old release and I wanted to set this new js up in our new environment. I have set it up as follows, but all I get is a quick green box flash and then it doesn't show up.

    I have the icon location defined in the js

    BlankIconLocation = "/CustomSpace/AssignToMeWatchUnwatchInGrid/empty.png";

    AssigntoMeIconlocation = "/CustomSpace/AssignToMeWatchUnwatchInGrid/recordassigned.png";

    UnassignfromMeIconlocation = "/CustomSpace/AssignToMeWatchUnwatchInGrid/recordunassigned.png";

    WatchIconLocation = "/CustomSpace/AssignToMeWatchUnwatchInGrid/watch.png";

    UnwatchIconLocation = "/CustomSpace/AssignToMeWatchUnwatchInGrid/unwatch.png";

    Folder is in /CustomSpace/AssignToMeWatchUnvatchInGrid and icons are in this folder.

    Is there a way for me to troubleshoot what is happening?

  • Donna_KennedyDonna_Kennedy Member IT Monkey ✭

    I have this working now. Please disregard my question.

Sign In or Register to comment.