File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Modern Development/Service Portal Widgets/Sticky Notes Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ ( function ( ) {
2+ data . messages = [ ] ;
3+ if ( input ) {
4+ data . messages = input . messages ;
5+ if ( input . action == "addMessage" ) {
6+ data . messages . push ( input . message ) ;
7+ if ( ! input . message ) {
8+ gs . addInfoMessage ( "Please enter value in text area" ) ;
9+ return ;
10+ }
11+ var rec = new GlideRecord ( 'u_sticky_notes' ) ; // 🔹 change this to your table
12+ rec . initialize ( ) ;
13+ rec . u_short_description = input . message ;
14+ rec . u_color = input . newColor ;
15+ // rec.setValue('u_short_description', input.inputValue); // 🔹 change 'name' to your field
16+ rec . insert ( ) ;
17+
18+
19+ }
20+ if ( input . action == "removeMessage" ) {
21+ data . messages . splice ( input . i , 1 ) ;
22+ console . log ( input . i ) ;
23+ var del = new GlideRecord ( 'u_sticky_notes' ) ;
24+ if ( del . get ( input . i ) ) {
25+ del . deleteRecord ( ) ;
26+
27+ }
28+ }
29+ }
30+
31+ var gr = new GlideRecord ( 'u_sticky_notes' ) ;
32+ gr . orderByDesc ( 'sys_created_on' ) ;
33+ gr . query ( ) ;
34+ data . notes = [ ] ;
35+ while ( gr . next ( ) ) {
36+ data . notes . push ( {
37+ sys_id : gr . getUniqueValue ( ) ,
38+ text : gr . getValue ( "u_short_description" ) ,
39+ color : gr . getValue ( "u_color" ) ,
40+ created_on : gr . getDisplayValue ( "sys_created_on" )
41+ } ) ;
42+ }
43+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments