Hide the agent name from the activity stream on the portal

Deepika Mishra
Mega Guru

In the conversation widget I only want to hide the agent name. I am not sure how to do it because both agent and the user who created the ticket is coming from {{::e.name}} which is coming from data.mergedEntries

Please help me how can I remove agent name only. Like in this case Deepika Mishra should not be visible but Aadd sh name should be visible.

find_real_file.png

1 ACCEPTED SOLUTION

Deepika Mishra
Mega Guru

I was able to implement the above scenario using below code:

HTML:

For the conversation:

<div class="timeline-title h4" ng-if="e.capture.show">{{::e.name}}</div>

Case created by:

<div class="timeline-title h4" ng-if="data.stream.capture.show">{{data.stream.user_full_name}}</div>

 

Server Side:

/* entries started */
		var entries1 = data.stream.entries;
		var existingEntries1 = "";
		
		data.array1 =[];
		
		for (var i = 0; i < entries1.length; i++) 
		{
			var showName = {} ;	
			existingEntries1 = entries1[i].user_sys_id.toString();
			if(gs.getUser().getUserByID(existingEntries1).hasRole('snc_internal'))
			   {
				   showName.show  = false;
			   }
			else
				{
					showName.show  = true;
				}
			
			data.array1.push(showName);
			entries1[i].capture = data.array1[i];
				
         }
		/*entries end*/
		
		/* created started */
		var entries2 = data.stream;
		var existingEntries2 = "";
		
			var showName2 = {} ;	
			existingEntries2 = data.stream.user_sys_id.toString();
		
			if(gs.getUser().getUserByID(existingEntries2).hasRole('snc_internal'))
			   {
				   showName2.show  = false;
			   }
			else
				{
					showName2.show  = true;
				}
			
			entries2.capture = showName2;
				
		/*created end*/

 

After adding these check I was able to hide the agent name and show only external agent name on the conversation widget.

View solution in original post

15 REPLIES 15

Pushpa Yadav1
Tera Guru

You can try something like:

Server Script:

data.assignedTo = gr.getValue('assigned_to');

HTML:

<div ng-if="data.assignedTo != e.user_sys_id"class="timeline-title h4">{{::e.name}}</div>

 

If this helps, please mark my response helpful/correct as applicable.

Thanks,

Pushpa

Hi Pushpa,

thanks for your input, but my requirement is that in this conversation widget the person who was snc_internal role that name should not pop up at all.

Means in this case I have snc_internal role, so in the entire conversation widget my name shouldn't appear. The other person name has to appear.

I wrote below code but somewhere I am not putting the right logic, could you help:

Server Side:

 if (gs.getUser().hasRole('snc_internal')) {
     data.checkLoggedInUser = gs.getUserID();
 }
else{
     data.checkLoggedInUser = gs.getUserID();
	}	

HTML:

<div class="timeline-title h4" ng-if="data.checkLoggedInUser != e.user_sys_id">{{::e.name}}</div>

Hello Deepika,

 

Why are you checking with gs.getUser().hasRole(), you can directly check something like gs.hasRole('snc_internal');

 

Try this below script - 

data.checkLoggedInUser = gs.getUserID();
data.showName = true;
if (gs.hasRole('snc_internal'))
{
     data.showName = false;
}

 

HTML should be something like this - 

<div ng-if="data.showName"class="timeline-title h4">{{::e.name}}</div>

 

Hope this helps.

 

Regards,

Omkar.

Hi Omkar,

I tried this but it is working in reverse way. Not showing the other name with snc_internal user login.