
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 08:12 AM
Hello SN Comm,
I have an Inbound Email Action to update an HR Case when it is in Pending Customer state.
When to run tab:
Type: Reply
Conditions: (Currently nothing)
Actions tab:
Field actions: State TO Work in Progress
Script:
gs.include('validators');
// Pending Customer Case moves to WIP from incoming email by customer
if (current.getTableName() == "hr_case" && current.state == 😎 {
current.work_notes= "reply from: " + email.origemail + "\n\n" + email.body_text;
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
}
***************************************
Want/need:
I want to have the ability for this Inbound Action to trigger ONLY when the email reply is someone attached to the Case (Example: if the reply coming in is the Requested For/ Caller)
I do NOT want this Inbound Email action to trigger if someone not working on the Case emails in to it (Example: if the reply coming in is a Manager of the group that the Case is assigned to, etc).
Mainly because when the Case state is in Pending Customer, the Customer is the one that needs to provide information. This is why I would like the Inbound Action to be triggered when the Customer emails back in to the Case.
Does this request make sense? I looked through the Conditions under When to run tab and none available seem to be what I need for this.
Hopefully I have explained this well enough to receive some help.
Any help is greatly appreciated!
Cheers,
-Rob
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 06:38 AM
Thanks everyone for your help on this!
I was able to configure the script to how I needed it, here is what I have:
gs.include('validators');
var userAddr = email.from;
gs.log("User email: " + userAddr);
// Update work notes regardless of who sends email
current.work_notes= "reply from: " + email.origemail + "\n\n" + email.body_text;
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
// Pending Customer Case moves to WIP from incoming email by requestor/requested for
if (current.getTableName() == "hr_case" && current.state == 8 && (current.caller.email == userAddr || current.opened_for.email == userAddr)) {
current.state = 18;
}
// Update case
current.update();
Inbound action records the incoming emails to Case Activity, all while NOT changing the State back to WIP UNLESS the email comes from Requestor/Requested For.
Thanks again for the help here!!
Cheers,
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2017 05:25 AM
Thanks a lot Fredrik,
I will have a chance today to go over this with my SN Teammate that is an Admin like I (but better at scripting right now), and see what we can do!
I very much appreciate your help here!
Cheers,
-Rob

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2017 06:38 AM
Thanks everyone for your help on this!
I was able to configure the script to how I needed it, here is what I have:
gs.include('validators');
var userAddr = email.from;
gs.log("User email: " + userAddr);
// Update work notes regardless of who sends email
current.work_notes= "reply from: " + email.origemail + "\n\n" + email.body_text;
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
// Pending Customer Case moves to WIP from incoming email by requestor/requested for
if (current.getTableName() == "hr_case" && current.state == 8 && (current.caller.email == userAddr || current.opened_for.email == userAddr)) {
current.state = 18;
}
// Update case
current.update();
Inbound action records the incoming emails to Case Activity, all while NOT changing the State back to WIP UNLESS the email comes from Requestor/Requested For.
Thanks again for the help here!!
Cheers,
-Rob