Cloned Ticket Field widget should be visible only to one catalog item on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2024 11:10 AM
Hello all,
Under "Request Something" in the portal we have different catalogs out of which one is a record producer. When any one of the catalog item is submitted , we see the below details from Ticket Fields Widget.
Requirement is to remove the priority field for only one of the catalog item(in this case the record producer) , When record producer is submitted priority field should not be shown , for this i had cloned the ticket fields widget and made the changes , but the changes are applied to all the catalog items.
How can i attach the cloned widget to the record producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2024 04:25 PM
Hi @Maruthi Ram,
One way to achieve this is by adding a condition in the client controller of the cloned widget. You can set up a condition to hide the priority variable if the catalog item's sys_id matches that of the record producer. Otherwise, it should remain visible for other catalog items by default. Finally, attach the cloned widget to the ticket conversation.
here is the code snippet for the logic
function($scope, $location) {
// Retrieve the current catalog item ID
var catalogItemId = $location.search().sys_id;
// The sys_id of the record producer catalog item
var recordProducerSysId = 'YOUR_RECORD_PRODUCER_SYS_ID';
// Watch for changes in the catalog item ID
$scope.$watch(function() {
return $location.search().sys_id;
}, function(newVal, oldVal) {
if (newVal) {
catalogItemId = newVal;
// Check if the catalog item ID matches the record producer ID
if (catalogItemId === recordProducerSysId) {
// Hide the priority field for the record producer
$scope.data.hidePriority = true;
} else {
// Show the priority field for other catalog items
$scope.data.hidePriority = false;
}
}
});
}
Ensure the HTML template uses the condition to hide the priority field
<div ng-if="!data.hidePriority">
<!-- Your existing priority field HTML goes here -->
</div>
Please mark it helpful and try to give it a thumbs up if the above helps. Please accept the solution.
Thanks & Regards
Tabassum Sultana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2024 01:37 PM
Hi @Maruthi Ram,
Have you considered using the standard_ticket page instead?
It looks like you are still using the old ticket page, with the standard_ticket page, you can easily configure what fields to display on the form per table/record without customizing the widget(s).
Cheers