- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-30-2017 07:47 AM
Hi Team,
How to get watch list for a particular ticket opened in service portal.
How to create a widget for this?
Any suggestions or ideas will help me a lot.
Thanks.
Solved! Go to Solution.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 05:42 PM
Hi Nithin,
Here is a quick widget I made, however it does not have any save functionality so you would have to add that. Also the sn-record-picker does not allow to add an email address as the usual watch list field does. If your goal is only to display a read of what was set on creation than this would do the job by simply setting sn-disabled="true".
HTML:
<div ng-if="data.canRead" class="panel panel-primary b">
<div class="panel-heading">
<h4 class="panel-title pull-left">
${Watch list}
</h4>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<div class="text-center text-italic text-muted">
<sn-record-picker field="watch_list" sn-disabled="!data.canWrite" table="'sys_user'" display-field="'name'" search-fields="'name'" value-field="'sys_id'" default-query="'active=true'" multiple="true"></sn-record-picker>
</div>
</div>
</div>
Client script:
function($scope, spUtil) {
var c = this;
$scope.watch_list = {
displayValue: c.data.displayValue,
value: c.data.value,
name: 'watch_list'
};
}
Server script:
(function() {
var table = $sp.getParameter('table')
var sys_id = $sp.getParameter('sys_id')
var gr = new GlideRecord(table);
if(gr.get(sys_id)){
data.canRead = gr.watch_list.canRead();
data.canWrite = gr.watch_list.canWrite();
if(data.canRead){
data.displayValue = gr.getDisplayValue('watch_list');
data.value = gr.getValue('watch_list');
}
}
})();
I know this is incomplete but I hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 08:36 AM
That only gives you the ability to provide a Watch List at time of ticket entry.
The widget is supposed to allow the ability to change it after submission.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 09:04 AM
In the ticket fields widget you are going to have to user sn-record-picker. To make it available to edit after the ticket is created:
HTML Template:
<sn-record-picker field="watch_list" sn-disabled="!data.canWrite" table="'sys_user'" display-field="'name'" search-fields="'name'" value-field="'sys_id'" default-query="'active=trueweb_service_access_only=falseuser_nameISNOTEMPTY'" multiple="true">
$
$
…
Client Script:
$scope.watch_list = ;
$scope.save = function(){
c.data.action = 'change_req_wl';
c.data.watchList = $scope.watch_list.value;
c.server.update().then(function(){
});
};
Server Script:
if(input && input.action=='change_req_wl'){
if(gr.watch_list != input.watchList || (gr.caller_id != input.req && input.req.length>0)){
if (gr.watch_list != input.watchList){
gr.watch_list = input.watchList; gr.update(); gs.addInfoMessage('Updated');
}
else{
gs.addErrorMessage("Update failed, you don't have the required access");
}
….
data.canWrite = gr.watch_list.canWrite();
…..
var dV = gr.getDisplayValue('watch_list');
var sV = gr.getValue('watch_list');
data.displayValue = dV == '' ? [] : dV;
data.value = sV == null ? [] : sV;
De: jued0001
Enviada em: segunda-feira, 19 de junho de 2017 12:37
Para: Juliana Mendo <jmraimundo@stefanini.com>
Assunto: Re: - How to get a watch list in widget in Service Portal ?
<https://community.servicenow.com/?et=watches.email.thread>
How to get a watch list in widget in Service Portal ?
reply from jued0001<https://community.servicenow.com/people/jued0001?et=watches.email.thread> in Platform - View the full discussion<https://community.servicenow.com/message/1176492?et=watches.email.thread#1176492>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 12:40 PM
Can you give screen shots of each? I feel like I'm missing something here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2017 01:13 PM
Hi Laurent,
I am getting bunch of errors while loading this widget. Did you came across any issues for this?
Also is there a way we can add email address to watchlist using this widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2017 01:19 PM
Sure:
HTML Template:
Cliente Script:
Server Script:
Obrigada,
Juliana Mendo
De: pranavparmar
Enviada em: terça-feira, 20 de junho de 2017 17:14
Para: Juliana Mendo <jmraimundo@stefanini.com>
Assunto: Re: - How to get a watch list in widget in Service Portal ?
<https://community.servicenow.com/?et=watches.email.thread>
How to get a watch list in widget in Service Portal ?
reply from Pranav Parmar<https://community.servicenow.com/people/pranavparmar?et=watches.email.thread> in Platform - View the full discussion<https://community.servicenow.com/message/1177817?et=watches.email.thread#1177817>