how can i give a condition so that my widget will be visible to only particular maintain item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2022 12:28 AM
how can i give a condition so that my widget will be visible to only particular maintain item

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2022 01:33 AM
You could just add it to the first div. I think adding a new div wrapping the whole thing with the ng-if, would be nicer though.
<div ng-if="showWidget()">
<div class="panel panel-default b" ng-init="c.trackPage()">
<div class="panel-heading" >
<h2 class="panel-title">{{::data.messages.myRequestsTitle}}</h2>
</div>
<div class="panels-container list-group" >
<div class="list-group-item row" style="margin:0px;border-top:0px;" >
<div class="col-md-5" style="">
<div class="input-group">
</div>
</div>
</div>
</div>
<div ng-if="c.data.request.req_list.length == 0 && !c.filterText" class="panel-body panels-container">
${You do not have any requests}
</div>
<div ng-if="c.data.request.req_list.length == 0 && c.filterText" class="panel-body panels-container">
${Search didn't match any requests}
</div>
<div role="table" class="table table-responsive m-b-none">
<div role="rowgroup" class="sr-only">
<div role="row">
<span role="columnheader">${Request}</span>
<span role="columnheader">${State}</span>
</div>
</div>
<div role="row" class="list-group-item table-responsive" ng-repeat="item in c.data.request.req_list | limitTo: c.data.lastLimit track by item.sys_id" style="margin:0px" >
<div role="cell" class="col-xs-6 padder-l-none padder-r-none main-column">
<div class="primary-display">
<a href="?id={{::item.url.id}}&table={{::item.url.table}}&sys_id={{::item.url.sys_id}}" sn-focus="{{::item.highlight}}"> {{::item.display_field}} </a>
</div>
<small class="text-muted">
<div ng-repeat="f in item.secondary_displays" class="secondary-display">
<span >{{::f.display_value}}</span>
</div>
</small>
</div>
<div role="cell" class="col-xs-3 padder-l-none padder-r-none state-column">
<div class="state">
<span> {{::item.state}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2022 01:44 AM
it's not working for me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2022 01:53 AM
and where to write script in client controller :
Client controller :
function(spAriaUtil, i18n) {
var c = this;
c.trackPage = function() {
window.GlideWebAnalytics.trackEvent("Service Catalog", "Catalog My Requests", "My Requests Widget Loaded");
}
if (c.data.is_new_order)
spAriaUtil.sendLiveMessage(c.data.requestSubmitMsg);
c.viewFilter = 'open';
c.changeView = function() {
window.GlideWebAnalytics.trackEvent("Service Catalog", "Catalog My Requests", "Open/Close Filter Toggled");
c.server.get({
action: "change_view",
view: c.viewFilter,
search_text: c.filterText
}).then(function(response){
c.data = response.data;
});
}
c.search = function() {
c.server.get({
action: 'search',
search_text: c.filterText,
view: c.viewFilter
}).then(function(response){
c.data = response.data;
var resultMsg = (c.data.request.req_list.length == 1 ? 'result' : 'results') + ' returned';
spAriaUtil.sendLiveMessage(i18n.getMessage('{0} ' + resultMsg).withValues([c.data.request.req_list.length]));
});
}
c.checkEnter = function(event) {
if (event.which === 13)
c.search();
}
c.loadMore = function() {
window.GlideWebAnalytics.trackEvent("Service Catalog", "Catalog My Requests", "Show More Clicked");
spAriaUtil.sendLiveMessage("${Loading more rows}");
c.fetching = true;
c.server.get({
action: 'fetch_more',
lastLimit: c.data.lastLimit,
view: c.viewFilter,
search_text: c.filterText
}).then(function(response){
c.data = response.data;
c.fetching = false;
});
}
};

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2022 02:24 AM
Anywhere inside
function(spAriaUtil, i18n) {
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2022 02:45 AM
var currentItemId; //add code to find currently viewing item sys_id
var showItemId = '1234' // sys_id of the item where you want to display the widget
$scope.showWidget = function() {
return currentItemId = showItemId;
}
I am confused between showItemID and currentItemId in both i have to give same sys_id ?