Skip to content

Commit bf7cbd4

Browse files
authored
HR Task Progress Bar On HRM Ticket Page (#2007)
* Create test.js * Delete Specialized Areas/Fix scripts/test.js * Create HTML.js * Update HTML.js * Create CSS.js * Create client_script.js * Create Server.js * Update CSS.js * Create HR Task Progress BarREADME.md * Delete Modern Development/Service Portal Widgets/HR Task Progress BarREADME.md * Create README.md * Update README.md * Update Server.js
1 parent f35b2a6 commit bf7cbd4

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*Parent container using flex to adjust width automatically*/
2+
.parent {
3+
display: flex;
4+
justify-content: space-evenly;
5+
background: cornflowerblue;
6+
}
7+
/*Text (HR task) will be shown in Red colo and green background*/
8+
.child{
9+
color:#FF0000;
10+
width:100%;
11+
background: lightgreen;
12+
}
13+
/*single color when task is not in WIP*/
14+
.child_1{
15+
width:100%;
16+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<!-- HTML to show progress bar on HRM Page -->
2+
<div class="parent">
3+
<div ng-class="{{tasks.state}}==18||data.state==18 ? 'child':'child_1'" ng-repeat="tasks in data.taskArr">
4+
{{tasks.number}}
5+
</div>
6+
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**Steps to add widget to page**
2+
1. Open "hrm_ticket_page" portal page.
3+
2. Create a widget with HTML, CSS, Client, Server code as per this document.
4+
3. Add the widget to top of "hrm_ticket_page" page.
5+
6+
**Output**
7+
1. If the HR case has associated tasks, those tasks will be shown as progress bar.
8+
2. WIP tasks will be shown with green background and red text.
9+
3. All other state tasks will be shown in black text and blue background.
10+
11+
12+
<img width="2144" height="1320" alt="image" src="https://github.com/user-attachments/assets/aaa00792-0f35-4f98-a46b-a60ef7270c33" />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function() {
2+
data.state = '';
3+
data.taskArr = []; // array to return HR task fields
4+
var recordId = $sp.getParameter('sys_id'); // get sys_id of HR case from URL
5+
var getTask = new GlideRecord('sn_hr_core_task');
6+
getTask.addEncodedQuery('parent=' + recordId); // encoded Query to get all task related to HR case
7+
getTask.query();
8+
while (getTask.next()) {
9+
var obj = {}; // object to store HR task values as JSON
10+
obj.number = getTask.getValue('number'); // add HR task number
11+
obj.state = getTask.getValue('state'); // add HR task state
12+
obj.sys_id = getTask.getValue('sys_id'); // add HR task sys_id
13+
data.taskArr.push(obj);
14+
}
15+
})();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
api.controller = function(spUtil, $scope) {
2+
/* widget controller */
3+
var c = this;
4+
// record watcher to show changes on progress bar dynamically
5+
spUtil.recordWatch($scope, "sn_hr_core_task", "active=true", function(name) {
6+
c.data.state = name.data.record.state;
7+
c.server.update();
8+
9+
});
10+
};

0 commit comments

Comments
 (0)