- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 12:51 AM
Hello All,
I am looking for help with the following request.
I have displayed some list of CIs using the following code in a widget
But whenever a record is selected out of the list I want that to redirect to a new Widget (on click of the record).
How to acheive that?
Window url is not going to work. how to make it work on selection of the record from the list
<div class="panel panel-primary">
<div class="panel-heading">
<h1 class="bg-primary">Client CIs
</h1>
</div>
<ul class="list-group result-container">
<li ng-repeat="inc in data.incident" ng-model = "c.fname" ng-click="c.openPopUp">
<a href>{{inc.ci}}</a>
</li>
</ul>
</div>
<!--<sp-widget widget="data.example"></sp-widget> --
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.incident=[];
data.user = gs.getUserID();
var gruser_list = new GlideRecord('cmdb_rel_person');
gruser_list.addQuery('user',data.user);
gruser_list.query();
var results = [];
while(gruser_list.next())
{
var inc = {};
//inc.user = gruser_list.getDisplayValue('user');
inc.ci = gruser_list.getDisplayValue('ci');
data.incident.push(inc);
}
//data.example = $sp.getWidget('demo', {});
})();
I have a widget to display some set of CIs
function($scope, $rootScope){
var c = this;
c.test = function()
{
c.data.tempname = c.fname;
var test = c.data.tempname;
alert(test);
$rootScope.$broadcast('xyz',test);//key - value function
//data.example = $sp.getWidget('demo', {});
c.openPopUp = function() {
var url = gs.getProperty() +"/sp";
var popup = window.open (url, "popup", "width=900, height=600");
}
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 01:13 AM
you need to replace the ng-click to below.You missed the paranthesis
ng-click="c.openPopUp()"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 01:00 AM
hello,
you can use top.window.location like below
var url ="your_url";
top.window.location =url;
Hope this helps
please mark my answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 01:02 AM
Hello Mohith,
Thanks for the reply
It is a custom widget 2 I created the above one is custom widget 1. Which URL should I put in?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 01:04 AM
you need to put the URL of the custom widget 2 .
Because on click of a record in custom widget one you need to redirect them to custom widget 2 .
so in url put custom widget 2 one
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2022 01:10 AM
I tried it didn't work. Am I doing something wrong
Client:
var url ="https://dev113490.service-now.com/sp_widget.do?sys_id=ea53b2f31b2551106eeda793604bcb2";
top.window.location =url;
I even made the Widget Public still didn't work
HTML
</div>
<ul class="list-group result-container">
<li ng-repeat="inc in data.incident" ng-model = "c.fname" ng-click="c.openPopUp">
<a href>{{inc.ci}}</a>
</li>
</ul>
</div>