File tree Expand file tree Collapse file tree 1 file changed +62
-0
lines changed
Server-Side Components/Inbound Actions/Reply TASK Expand file tree Collapse file tree 1 file changed +62
-0
lines changed Original file line number Diff line number Diff line change 1+ //Reply Inbound Email Action
2+ // Table - sc_task
3+
4+ // Type - Reply
5+ //Order - 100
6+
7+ // Condition - Subject - has been assigned for Satiesfiction
8+
9+ //Script
10+
11+ gs . include ( 'validators' ) ;
12+
13+ if ( current . getTableName ( ) == "sc_task" ) {
14+
15+ // Update comments on current sc_task and save it
16+ current . comments = "reply from: " + email . origemail + "\n\n" + email . body_text ;
17+
18+
19+ // Parse Date (YYYY-MM-DD)
20+ var DateMatch = email . body_text . match ( / D a t e : \s * ( [ \d ] { 4 } - [ \d ] { 2 } - [ \d ] { 2 } ) / i) ;
21+
22+ var DateStr = DateMatch ? DateMatch [ 1 ] : null ;
23+
24+ // Parse "Are you good to Processed "
25+ var process = email . body_text . match ( / A r e y o u g o o d t o P r o c e s s e d \? \s * : \s * ( Y e s | N o ) / i) ;
26+
27+ var proceeStr = process ? procee . match [ 1 ] . toLowerCase ( ) : null ;
28+
29+
30+ if ( DateStr ) {
31+ var gd = new GlideDate ( ) ;
32+ gd . setValue ( DateStr ) ;
33+ parentCaseGR . setValue ( 'u_date' , gd ) ; // replace with your field
34+
35+ }
36+
37+ // Update "Are you good to Process" if found
38+ if ( proceeStr ) {
39+
40+ var normalizedInput = proceeStr . toLowerCase ( ) ;
41+
42+ var choiceValue = null ;
43+ if ( normalizedInput === 'yes' ) {
44+ choiceValue = '1' ; // choice value for Yes
45+ } else if ( normalizedInput === 'no' ) {
46+ choiceValue = '2' ; // choice value for No
47+ }
48+
49+ if ( choiceValue ) {
50+ parentCaseGR . setValue ( 'u_processed' , choiceValue ) ;
51+
52+ }
53+ }
54+
55+
56+
57+ }
58+
59+ current . state = 3 ;
60+ current . update ( ) ;
61+ }
62+
You can’t perform that action at this time.
0 commit comments