in Portals to sort the values

instance
Tera Contributor

In Portals under My open incidents . i want on hold state records should be seen at top. and should be in Different colour. how to do this ?

 

1 ACCEPTED SOLUTION

@instance  

See thats how it is when you comes to sorting.

When you say Descending then state values will be used to order and show under widget.

Now if you still want onhold to apprear first then you will need to set Resolved at lower order.

Eg: right now resolved - 6 , on hold - 3 and in progress -2

So when you set to descending the 6 will come first which is Resolved, you can change the value to something like 1 but less than 3 so that resolved incidents will go at lower side . I will not recommend this just to have this behaviour under this widget and impact of doing this is instance wide.

 

There is also other option by just by not considering resolved incidents under 'My Open Incidents' which can be done by adding same in filter condition at same location like below:

sushantmalsure_0-1681292364149.png

and then you will have on hold at top

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

View solution in original post

10 REPLIES 10

@sushantmalsure  no its Not possible when we have state Resolved  also . by descending means state resolved will come first

have you tried doing it to Ascending ?

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

@sushantmalsure  Ascending Means State New will come first

@instance  

See thats how it is when you comes to sorting.

When you say Descending then state values will be used to order and show under widget.

Now if you still want onhold to apprear first then you will need to set Resolved at lower order.

Eg: right now resolved - 6 , on hold - 3 and in progress -2

So when you set to descending the 6 will come first which is Resolved, you can change the value to something like 1 but less than 3 so that resolved incidents will go at lower side . I will not recommend this just to have this behaviour under this widget and impact of doing this is instance wide.

 

There is also other option by just by not considering resolved incidents under 'My Open Incidents' which can be done by adding same in filter condition at same location like below:

sushantmalsure_0-1681292364149.png

and then you will have on hold at top

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Weird
Mega Sage

OOB you're out of luck. The order by functionality is neat, but doesn't allow you to specify something as important.


You can modify the Simple List widget to work in your way.
Around line 13 there's a <li> element that you'll need to modify.
The <li> element looks something like this:

 

<li ng-repeat="item in c.data.list track by item.sys_id" class="list-group-item">

 

You'll want to change it to

 

<li ng-repeat="item in c.data.list | filter:{top:true} track by item.sys_id" class="list-group-item"  ng-style="{'background-color':'red'}">

 

Note that the <li> element contains a lot of stuff. If you've opened the widget in widget editor you can collapse it, but the most imporant thing now is to find the closing tag </li>. It's around line 44 before the ul element.
Now copy the whole <li> element and paste it right after again.
Now in the second li element do the following changes:

 

<li ng-repeat="item in c.data.list | filter: {top:false} track by item.sys_id" class="list-group-item">

 

 
It should now look a bit like this:

Joni9_0-1681297330316.png



Now in the server side you'll have to add this after line 80 record.classname = gr.getRecordClassName();:

 

		if(gr.state == '1'){
		record.top = true;	
		}else{
			record.top = false;
		}

 

 It doesn't really matter much where you do as long as it's after var record = {}; and before data.list.push(record);

Now what will happen is that you'll first have li elements for records that have state as 1. Then li elements for anything else. I've set the filter to record.top as you can easily then modify anything else to go on top as well by modifying the if else on server side.