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
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
Everything is always possible (at least I like to believe ). 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!
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
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.
Can replicate this problems as well and are working on a fix as soon as I get the time!
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.
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!
Attached updated version!
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!
Fixed it so it should work regardless of locale settings. Please see attached updated version!
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!
(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?
// 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();
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!
Move the "}" on line 34 to line 37/38 after the "assignToMeObserver.disconnect();
"
Before:
After:
Testet with portal 8.8.2.2016
hi guys
can someone confirm if this works in Portal 9. Tried it, but no joy
It works if you edit the code as described in my post from september 2018
Hello, for those interested I have fixed a couple bugs that I have found in this script :
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
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!
Hi all,
Anyone has tested this on Portal V 9.4.5? We couldn't make it work.
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.
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?
I have this working now. Please disregard my question.