Hiding work notes from Employee Center Portal

vidhya_mouli
Giga Sage

Is there a way to hide work notes from Employee Portal. Right now work notes is not visible for non itil users and is visible for ITIL users. This is for incident management (using Standard ticketing widget).

1 ACCEPTED SOLUTION

vidhya_mouli
Giga Sage

Finally managed to do it. To remove work notes form employee center for everyone, I had to do the following:

Step 1. Clone Standard Ticket Conversation Widget (standard_ticket_conversations_sv) and added few lines of code in the client script.

 

 

 

 

function mergeStreamEntries() {
		$scope.placeholder = $scope.data.placeholderNoEntries;
		if (!$scope.data.stream || !$scope.data.stream.entries)
			return;
		$scope.placeholder = $scope.data.placeholder;
		
		//****************** NEW CODE ADDED ********************************//
		var newEntries = [];
        $scope.data.stream.entries.forEach(function(entry) {
    	if (entry.element != "work_notes") {
    		newEntries.push(entry);
    	}
    });
		
		$scope.data.stream.entries = newEntries;
		//****************** NEW CODE ADDED ********************************//


	
		$scope.data.rich_text_editor = (c.options.rich_text_editor == 'true');
		$scope.data.at_mentions = (c.options.at_mentions == 'true');
		unblockTheComments();
		var entries = $scope.data.stream.entries;
		if (!$scope.data.mergedEntries) {
			$scope.data.mergedEntries = $scope.data.stream.entries.slice();
			for (var i = 0; i < entries.length; i++) {
				if (entries[i].value)
					entries[i].value = entries[i].value.replace(/\n/g, '<br/>');
				existingEntries[entries[i].sys_id] = true;
			}

			return;
		}

		var mergedEntries = $scope.data.mergedEntries;
		for (var i = entries.length-1; i >= 0; i--) {
			var curEntry = entries[i];
			if (isNewEntry(mergedEntries, curEntry)){
				if (curEntry.value)
					curEntry.value = curEntry.value.replace(/\n/g, '<br/>');
				mergedEntries.unshift(curEntry);
				existingEntries[curEntry.sys_id] = true;
			}
		}
	}

 

 

 


Step 2. Clone Standard Ticket Tab and replaced couple of widget.

Changed std_ticket_conversations to standard_ticket_conversations_sv in couple of places.

 

Finally Step 3: Replaced the Standard Ticket Tab with the cloned widget in Page Editor.

 

View solution in original post

4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

have multiple threads on the same topic, hard to follow and no response back.

You asked the same thing here  Issue with work_notes visibility. - ServiceNow Community Based on user, now its the roles.

-Anurag

I started a new thread to make it more clear. Sorry, was not able to delete the old thread.

vidhya_mouli
Giga Sage

Finally managed to do it. To remove work notes form employee center for everyone, I had to do the following:

Step 1. Clone Standard Ticket Conversation Widget (standard_ticket_conversations_sv) and added few lines of code in the client script.

 

 

 

 

function mergeStreamEntries() {
		$scope.placeholder = $scope.data.placeholderNoEntries;
		if (!$scope.data.stream || !$scope.data.stream.entries)
			return;
		$scope.placeholder = $scope.data.placeholder;
		
		//****************** NEW CODE ADDED ********************************//
		var newEntries = [];
        $scope.data.stream.entries.forEach(function(entry) {
    	if (entry.element != "work_notes") {
    		newEntries.push(entry);
    	}
    });
		
		$scope.data.stream.entries = newEntries;
		//****************** NEW CODE ADDED ********************************//


	
		$scope.data.rich_text_editor = (c.options.rich_text_editor == 'true');
		$scope.data.at_mentions = (c.options.at_mentions == 'true');
		unblockTheComments();
		var entries = $scope.data.stream.entries;
		if (!$scope.data.mergedEntries) {
			$scope.data.mergedEntries = $scope.data.stream.entries.slice();
			for (var i = 0; i < entries.length; i++) {
				if (entries[i].value)
					entries[i].value = entries[i].value.replace(/\n/g, '<br/>');
				existingEntries[entries[i].sys_id] = true;
			}

			return;
		}

		var mergedEntries = $scope.data.mergedEntries;
		for (var i = entries.length-1; i >= 0; i--) {
			var curEntry = entries[i];
			if (isNewEntry(mergedEntries, curEntry)){
				if (curEntry.value)
					curEntry.value = curEntry.value.replace(/\n/g, '<br/>');
				mergedEntries.unshift(curEntry);
				existingEntries[curEntry.sys_id] = true;
			}
		}
	}

 

 

 


Step 2. Clone Standard Ticket Tab and replaced couple of widget.

Changed std_ticket_conversations to standard_ticket_conversations_sv in couple of places.

 

Finally Step 3: Replaced the Standard Ticket Tab with the cloned widget in Page Editor.

 

I'm a little curious about what you did in step 2, can you elaborate on couple of widget, and couple of places. We have this exact issue.