How to hide attachment in service portal?

Shweta KHAJAPUR
Tera Guru

Hi Experts,

How to disable the attachment appearance in activity log of incident form in the portal. In main console i'm able to hide it, But i want to hide it in service portal also. The highlighted part i want to hide. It should only apper in Ticket attachment widget.

find_real_file.png

7 REPLIES 7

Saad8
Giga Contributor
	function mergeStreamEntries() {
		$scope.placeholder = $scope.data.placeholderNoEntries;
		if (!$scope.data.stream || !$scope.data.stream.entries)
			return;

		$scope.placeholder = $scope.data.placeholder;
		//for hiding attachment in ticket conversation widget, will still be visible in the back end
		var modifiedEntries = [];
       $scope.data.stream.entries.forEach(function(entry) {
               if (entry.element != ("attachment")) {
                       modifiedEntries.push(entry);
               }
       });
		$scope.data.stream.entries = modifiedEntries;
		var entries = $scope.data.stream.entries;
		
		for (var i = 0; i < entries.length; i++) {
		    if (entries[i].attachment)
		        entries[i].attachment = $scope.attachmentHandler.canViewImage([entries[i].attachment])[0];
		}
		
		
		if (!$scope.data.mergedEntries) {
			$scope.data.mergedEntries = $scope.data.stream.entries.slice();
			for (var i = 0; i < entries.length; i++) {
				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)){
				mergedEntries.unshift(curEntry);
				existingEntries[curEntry.sys_id] = true;
			}
		}
	}

Replace the 'function mergeStreamEntries()' in the client script of the cloned Ticket Conversation widget ( yes you have to clone it because you cannot edit the OOB Ticket conversation widget) with the function above and you will not see attachments on the ticket conversation widget anymore.

This is very useful, Is there a way to make this code apply to a single type of Record Producer and not all records?

Neha29
Tera Contributor

it worked. thanks