Skip to content

Commit 922f2a3

Browse files
Create reminders_server.js
1 parent aba93e9 commit 922f2a3

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
(function() {
2+
3+
var currentUserId = gs.getUserID();
4+
data.reminders = [];
5+
6+
7+
if (input && input.action === 'create_reminder') {
8+
var newReminder = new GlideRecord('reminder');
9+
newReminder.initialize();
10+
newReminder.setValue('user', currentUserId);
11+
newReminder.setValue('task', input.newReminder.task);
12+
newReminder.setValue('subject', input.newReminder.subject);
13+
newReminder.setValue('notes', input.newReminder.notes);
14+
newReminder.setValue('remind_me', input.newReminder.remind_me);
15+
newReminder.setValue('field', input.newReminder.field);
16+
newReminder.setValue('using', input.newReminder.using);
17+
newReminder.insert();
18+
}
19+
20+
21+
var reminderGR = new GlideRecord('reminder');
22+
reminderGR.addQuery('user', currentUserId);
23+
reminderGR.orderByDesc('sys_created_on'); // Show newest first
24+
reminderGR.query();
25+
26+
while (reminderGR.next()) {
27+
var reminderObj = {};
28+
reminderObj.sys_id = reminderGR.getUniqueValue();
29+
reminderObj.subject = reminderGR.getValue('subject');
30+
reminderObj.notes = reminderGR.getValue('notes');
31+
reminderObj.remind_me = reminderGR.getValue('remind_me');
32+
reminderObj.field_display = reminderGR.getDisplayValue('field'); // Get user-friendly display value
33+
reminderObj.using = reminderGR.getValue('using');
34+
reminderObj.task_display = reminderGR.getDisplayValue('task'); // Get task number/display value
35+
data.reminders.push(reminderObj);
36+
}
37+
38+
})();

0 commit comments

Comments
 (0)