File tree Expand file tree Collapse file tree 1 file changed +12
-21
lines changed
Modern Development/Service Portal Widgets/Sticky Notes Expand file tree Collapse file tree 1 file changed +12
-21
lines changed Original file line number Diff line number Diff line change 11( function ( ) {
2- data . messages = [ ] ;
32if ( input ) {
4- data . messages = input . messages ;
5- if ( input . action == "addMessage" ) {
6- data . messages . push ( input . message ) ;
7- if ( ! input . message ) {
3+ if ( input . action == "add" ) {
4+ if ( ! input . text ) {
85 gs . addInfoMessage ( "Please enter value in text area" ) ;
96 return ;
107 }
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' ) ;
8+ var rec = new GlideRecord ( 'u_sticky_notes' ) ;
9+ rec . initialize ( ) ;
10+ rec . u_short_description = input . text ;
11+ rec . u_color = input . newColor ;
12+ rec . insert ( ) ;
13+ }
14+ if ( input . action == "remove" ) {
15+ var del = new GlideRecord ( 'u_sticky_notes' ) ;
2416 if ( del . get ( input . i ) ) {
2517 del . deleteRecord ( ) ;
26-
2718 }
28- }
19+ }
2920}
3021
31- var gr = new GlideRecord ( 'u_sticky_notes' ) ;
22+ var gr = new GlideRecord ( 'u_sticky_notes' ) ;
3223 gr . orderByDesc ( 'sys_created_on' ) ;
3324 gr . query ( ) ;
3425 data . notes = [ ] ;
You can’t perform that action at this time.
0 commit comments