Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Server-Side Components/Inbound Actions/Reply Task/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#contribution

An SC Task is assigned to the requester. When the requester replies with the following format:

Are you good to proceed? Yes
Date: 20-10-2025

…the reply information is automatically extracted and populated into custom fields on the SC Task record.

Two custom fields have been created for this purpose:

Date:20/10/2025

Process: Yes

Inbound Email Action:
---------------------
Created Reply Inbound email action on sc_task table.
Table - sc_task
Type - Reply
Condition - Subject : has been assigned for Satiesfiction.

Objective of the code:
-----------------------

When a requester replies to an SC Task email with specific text (like "Are you good to Processed? Yes" and "Date: 2025-10-20"), this script:

Updates task comments with the reply
Uses regex to search for date and tries to extract a Yes/No response from a line like:

Are you good to proceed? Yes
Date: 20-10-2025

Populates two custom fied the SC Task (u_date, u_processed)

Sets the task's state to 3 (Completed) once reply done & extract and auto population performed.
51 changes: 51 additions & 0 deletions Server-Side Components/Inbound Actions/Reply Task/reply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
gs.include('validators');

if (current.getTableName() == "sc_task") {

// Update comments on current sc_task and save it
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;


// Parse Date (DD-MM-YYYY)
var DateMatch = email.body_text.match(/Date:\s*([\d]{2}-[\d]{2}-[\d]{4})/i);

var DateStr = DateMatch ? DateMatch[1] : null;

// Parse "Are you good to Processed "
var process = email.body_text.match(/Are you good to Processed\?\s*:\s*(Yes|No)/i);

var proceeStr = process ? procee.match[1].toLowerCase() : null;


if (DateStr) {
var gd = new GlideDate();
gd.setValue(DateStr);
current.setValue('u_date', gd); // replace with field

}

// Update "Are you good to Process" if found
if (proceeStr) {

var normalizedInput = proceeStr.toLowerCase();

var choiceValue = null;
if (normalizedInput === 'yes') { //converting Yes/ No field to 1 , 2 as per backend field sc_task
choiceValue = '1'; // choice value for Yes
} else if (normalizedInput === 'no') {
choiceValue = '2'; // choice value for No
}

if (choiceValue) {
current.setValue('u_processed', choiceValue); //set value in custom field

}
}



}

current.state = 3;
current.update();
}
Loading