Skip to content

Commit a1f7d83

Browse files
authored
Open in Platform/SOW - enhancement (#2189)
* Create test.js * Delete Specialized Areas/Fix scripts/test.js * Update server.js * Update body.html * Create option schema.js * Create css.js * Update README.md * Update README.md
1 parent 116dad1 commit a1f7d83

File tree

5 files changed

+44
-14
lines changed

5 files changed

+44
-14
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
Widget will create a button that will only be visable to users with the itil role that will take them to the same record in platform. will work with the form and standard ticket pages (or anywhere with the table and sysId in the url.
1+
**This is an enhancement to the current code**
2+
1. Added "open in SOW" Button to open the record in service operations workspace, since it is gaining popularity now.
3+
2. Enhanced the visibility condition so that the button is only visible on pages having sys_id and table in url.
4+
3. Enhanced css to improve visibility of button.
25

3-
see also [on Share](https://developer.servicenow.com/connect.do#!/share/contents/6592535_open_in_platform_widget?t=PRODUCT_DETAILS)
6+
Widget will create a button that will only be visable to users with the itil role that will take them to the same record in platform. will work with the form and standard ticket pages (or anywhere with the table and sysId in the url.
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div>
2-
<span ng-if="::data.role==true">
3-
<a href="{{::data.url}}" target='_blank'class='btn btn-default'>{{::options.button_text}}</a>
4-
</span>
2+
<span class="btn-cntr" ng-if="::data.role==true">
3+
<a href="{{::data.platform_url}}" target='_blank'class='btn btn-default'>{{::options.open_in_platform}}</a><br> <!--Platform button configuration-->
4+
<a href="{{::data.sow_url}}" target='_blank'class='btn btn-default'>{{::options.open_in_sow}}</a> <!--SOW button configuration-->
5+
</span>
56
</div>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
This styling will align buttons on 2 ends of the div.
3+
*/
4+
.btn-cntr{
5+
display: flex;
6+
justify-content: space-between;
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"name":"open_in_platform",
4+
"type":"string",
5+
"label":"Name for Plarform Button",
6+
"default_value":"Open in Platform"
7+
},
8+
{
9+
"name":"open_in_sow",
10+
"type":"string",
11+
"label":"Name for SOW Button",
12+
"default_value":"Open in SOW"
13+
}
14+
]
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
(function() {
2-
data.table = input.table || $sp.getParameter("table");
3-
data.sys_id = input.sys_id || $sp.getParameter("sys_id");
4-
5-
data.url = "/nav_to.do?uri="+data.table+".do?sys_id="+data.sys_id;
6-
7-
data.role = false;
8-
if (gs.hasRole("itil")){
9-
data.role = true;
10-
}
2+
/*
3+
Code will get table and sys_id parameter from url and create url for platform and sow.
4+
This widget can be used in any page having sys_id and table in url , eg: ticket page.
5+
*/
6+
data.table = input.table || $sp.getParameter("table"); // get table from url
7+
data.sys_id = input.sys_id || $sp.getParameter("sys_id"); // get sys_id from url
8+
9+
data.platform_url = "/nav_to.do?uri=" + data.table + ".do?sys_id=" + data.sys_id;
10+
data.sow_url = "now/sow/record/" + data.table + "/" + data.sys_id;
11+
12+
data.role = false;
13+
if (gs.hasRole("itil") && data.table && data.sys_id) { // only visible to users with itil role and if url has required parameters.
14+
data.role = true;
15+
}
1116
})();

0 commit comments

Comments
 (0)