2

1

I often have conversations in cases where a user assigns the case to me, then I assign it back with a response. That requires me to click Assign, pick the user and hit enter, then put my comment in and submit. Can I streamline that?

flag

1 Answer

2

This script will find the most recent "assigned" event in the case and create a link in the case to start editing the case with the assign-to set to the person who made that recent assignment.

name:          Assign-Back case link
description:   Adds a link in case view to assign the case back to the last assigner
author:        Adam Wishneusky, Michel de Ruiter
version:       1.1.0.0

js:

var ignoreMe = true; // Set to false to assign back to yourself as well.
if (!$('#bugviewContainer').length)
  return;
if (goBug.ixPersonAssignedTo != GetPersonID())
  return;
var lastAssigner =
  $('div.bugevents div.bugevent div.summary span.action:contains("ssigned to")' +
    (ignoreMe ? ':not(:contains("by ' + $(username).text() + '"))' : '') +
    ':' +(fMostRecentEventFirst ? 'first' : 'last') + ' a.person + a.person');
if (!lastAssigner.length)
  return;
window.AssignBack = function() {
  $('#edit0').click();
  $('select#ixPersonAssignedTo').val(lastAssigner.attr('data-ixperson')).change();
  DropListControl.refresh($('select#ixPersonAssignedTo')[0]);
}
var linkSwipeHtml = '<a onclick="javascript:AssignBack()" href="#" title="to ' +
  lastAssigner.text() + '">Assign Back</a>';
$('span.categoryAndAssignedTo').append(' ' + linkSwipeHtml);
link|flag
Fantastic! I improved it a bit (I hope) to work with either fMostRecentEventFirst, include lower case assigned events, (optionally) skip yourself and show a tooltip with who to assign to. Feel free to fix or further improve! – Michel de Ruiter Aug 9 at 9:52
awesome! :) – adambox Aug 9 at 13:51
I have a quick question, how would you modify this to retrieve the person before the last assigned person. The reason I'm asking is because in our process the last person will be a virtual account and not the actual person who did the work. – aStokes Sep 25 at 11:54
1 
the var lastAssigner line gets the first or last element of the list of assigners. change it to this to get the whole list: var Assigners = $('div.bugevents div.bugevent div.summary span.action:contains("ssigned to")' + (ignoreMe ? ':not(:contains("' + $(username).text() + '"))' : '') + ' a.person + a.person'); then based on fMostRecentEventFirst grab either the 0th element or the last one. – adambox Sep 25 at 13:17
awesome thank you – aStokes Oct 4 at 18:18

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.