Activity - Missing collapse/expand (all activities)

veronikak_
Giga Contributor

Hi all,

I am looking the functionality for collapse/expand for the activity as it was in fuji and another releasis before.

On all type of tasks (INC, REQ, PRB etc) activity section is by default expended which doesn't looks nice and where ever activity logs are many it takes ages to scroll to the end of the form.

Is collapse/expand simple missing or must be frist somehow activated?

, can we somehow have the button to expand and collapse it.

Do you have some experience with?

Thank you.


Veronika

1 ACCEPTED SOLUTION

My colleague opened an incident @ ServicenNow HI-Portal.



Answer from support:



----



I just found that this is a known issue, logged in PRB663462 - UI16: Collapse/Expand feature not available on Activity


I have related this problem ticket to this issue. The problem will be reviewed and most likely fixed in a future release or patch.


Since customers have access to problem records, please keep track of the progress on the problem ticket (PRB663462).


You can now view the current status of the Problems associated to your incidents by navigating to: Self Service --> Problems.


As workaround you could switch to UI15 since the Collapse/Expand feature is still available.


View solution in original post

21 REPLIES 21

Sharek,



Thanks for the code. I have tested this in Helsinki patch 1 and it works like a charm after changing the class from ".activities.activities-form" to ".h-card-wrapper.activities-form"


Thanks that was a useful update.



I further changed the class to "sn-widget" to make it even better


I have implemented the script from sharekullah on Istanbul Patch 9, and its working well with the update from pavankottam.



joost, can you clarify which class did you change to "sn-widget"?


I changed lines 12 and 22 so now, instead of collapsing the whole thing, it does it by section.


find_real_file.png


Thank you joostjoost . Based on the previous script and your response I have created an client script that recreates the activity buttons (toggle and collapse) in UI16 as they are in UI15, including saving the last used setting in a user preference. I only need it on a specific form, so that's why I choose for a client script. The advantage is that it also removed the requirement to add a timer to wait for the angular completion. The user preferences part also works in a (global) UI script, but you need to add the timer to line 6.



Update: Since users liked the functionality, the also asked for it on other (task) forms. I implemented the below client script on the task table and checked "inherited", so it works on all task extended tables.


FJ_Toggle_Activity___DEV.png



function onLoad() {


  try{


            /* set delay to allow the activity log section to be generated by AngularJS.


            Without delay, you get an arrow popup when button is pushed. */


            $j(document).ready(function(){


                      addActivityToggle();


            });


  }


  catch(e){


            alert('Error in processing addActivityToggle function due to: ' + e.message);


  }


}




function addActivityToggle(){


  //Check to see if an element with the class name of 'h-card-wrapper.activities-form' exists


  if($j('.h-card-wrapper.activities-form').length){


  var user_collapsed = getPreference('user.actvitiy.collapsed');


  if (!user_collapsed) {


                      user_collapsed = false;


  setPreference('user.actvitiy.collapsed', false);


  }


  var user_toggle = getPreference('user.actvitiy.toggle');


  if (!user_toggle) {


  user_toggle = false;


  setPreference('user.actvitiy.toggle', false);


  }



  // Create the html for the collapse icon\button


  var collapseButton = '<button id="activity_collapse_button" type="button" class="btn btn-default btn-ref icon-remove sn-popover-basic"><span class="sr-only">Toggle Activity</span></button>';



  // Create the html for the toggle icon\button


  var toggButton = '<button id="activity_toggle_button" type="button" class="btn btn-default btn-ref icon-chevron-down sn-popover-basic"><span class="sr-only">Toggle Activity</span></button>';



  //Prepend the collapse button before the filter button


  $j('#activity_field_filter_popover').parent('.form-field-addons').prepend(collapseButton);



  //Append the toggle button after the filter button


  $j('#activity_field_filter_popover').parent('.form-field-addons').append(toggButton);



  //Add the click function to hide\show the activity


  $j("#activity_toggle_button").click(function(){


  $j('.h-card-wrapper.activities-form').toggle(250, function(){


  //Set the icon image to icon-chevron-left when the activity is hidden.


  if($j(this).css('display') == 'none'){


  $j("#activity_toggle_button").removeClass('icon-chevron-down').addClass('icon-chevron-left');


  setPreference('user.actvitiy.toggle', true);



  }


  else{ //Else set the icon image to icon-chevron-down


  $j("#activity_toggle_button").removeClass('icon-chevron-left').addClass('icon-chevron-down');


  setPreference('user.actvitiy.toggle', false);


  }


  });


  });



  //Add the click function to collapse activity


  $j("#activity_collapse_button").click(function(){


  $j('.sn-widget').toggle(250, function(){


  if($j(this).css('display') == 'none'){ //Set the icon image to icon-add when the activity is hidden


  $j("#activity_collapse_button").removeClass('icon-remove').addClass('icon-add');


  setPreference('user.actvitiy.collapsed', true);


  }


  else{ //Else set the icon image to icon-remove


  $j("#activity_collapse_button").removeClass('icon-add').addClass('icon-remove');


  setPreference('user.actvitiy.collapsed', false);


  }


  });


  });



  if (user_collapsed) $j("#activity_collapse_button").trigger('click');


  if (user_toggle) $j("#activity_toggle_button").trigger('click');



  }


}