- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2014 01:11 PM
I was trying to create an Inbound Action where the senders are all part of the same group. The type needs to be forwarded. I have come up with an Action that will work with a list of users, which may be helpful to someone.
I was wondering how to create a condition that looks at the user who forwarded the email, checks their group, and if they are a member of a specific group, processes the inbound action. I have the order , and email processing order plugin sorted out, so I know when to stop processing the action. A also thought I could use the 'from:' field.
Maybe the answer is in my script, something like "from.group == "Service-Desk" {
Any suggestions welcome if someone has done this already. Here's what I have for specific users if anyone needs something similar. Many thanks, Mark S.
type=forward, co condition, uses validators.
gs.include('validators');
var from = gs.createUser(email.body.from);
//need more than one email address to work with validators
if (from == "john.doe@somewhere.com"||"james.doe@thisplace.com")
{
current.opened_by = from;
current.caller_id = email.from;
current.assignment_group = "sys_id of assignment group here";
current.assigned_to = email.from;
current.state = 1;
current.contact_type = "email";
current.short_description = email.subject;
current.description = "Email received from: " + email.origemail + "\n" + "Email copied to: " + email.to + "\n" + "Subject: " + email.subject + "\n\n" + email.body_text;
//send to log user who forwarded email.
gs.log("***Inbound Action from " + email.body.from);
event.state="stop_processing";
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2014 08:36 PM
This may look convoluted, but set this as your condition:
gs.getUser(). ÂgetUserByID( Âsys_email.getValue("user_id")). ÂisMemberOf( Â"GroupName")
It creates a user object [gs.getUser()], fetches the user record for the user that sent the email [ ÂgetUserByID( Âsys_email.getValue("user_id"))] and checks to see if the user is a member of a particular group [ ÂisMemberOf( Â"GroupName")]. "sys_email" is a GlideRecord of the email that is being processed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2014 04:11 PM
I have tried bother the methods here, and I thank you for your responses.
With the script I have, I get a log message:
"Skipping 'Create Incident EAS TEST 6', did not create or update incident"
Also the log shows "*** 1 - Inbound Action fromcom.glide.sys.User@9d56d2" for my gs.log capture. I know you have "abel.tutor" in your script, but what am I supposed to replace it with? email.from? Cheers, Mark S.
My latest version is :
var myUserObject = gs.getUser();
myUserObject = myUserObject.getUserByID('abel.tuter'); //Pass sys_id or User Id
gs.log("*** 1 - Inbound Action from" + myUserObject);
if(myUserObject.isMemberOf('ServiceNow Administrators') || myUserObject.isMemberOf('IT - ServiceNow Support')){
current.urgency = 1;
current.impact = 1;
current.opened_by = from;
current.caller_id = email.from;
current.assignment_group = "33194bd90a0a3ce00100f0f13b5f845e";
current.state = 1;
current.contact_type = "email";
current.short_description = email.subject;
gs.log("*** 2 - Inbound Action from" + myUserObject);
current.insert();
event.state="stop_processing";
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2014 08:36 PM
This may look convoluted, but set this as your condition:
gs.getUser(). ÂgetUserByID( Âsys_email.getValue("user_id")). ÂisMemberOf( Â"GroupName")
It creates a user object [gs.getUser()], fetches the user record for the user that sent the email [ ÂgetUserByID( Âsys_email.getValue("user_id"))] and checks to see if the user is a member of a particular group [ ÂisMemberOf( Â"GroupName")]. "sys_email" is a GlideRecord of the email that is being processed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2014 04:48 PM
Better late than never, but the condition option worked perfectly, thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-09-2014 09:01 PM
Many thanks again for the excellent responses, certainly good for my brain. Creating the condition seems to have done the trick, I just have to test a few times, and i should be good. Once that is done, I'll will close the discussion appropriately. Thanks Mandar, Solutioner, and Jim Coyne for his last reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2014 04:50 PM
Forgot to add this snippet from ServiceNow:
About Rollbacks and Backups
When planning an upgrade, note that ServiceNow does not provide a rollback option or perform on-demand backups. Instances are automatically backed up daily during non-peak business hours on schedules defined by ServiceNow. We do not adjust the timing of existing backup schedules.
Avoid restoring a production instance from backup, when possible, due to downtime and data loss. Restoring a production instance from backup is a final option when a problem cannot be solved using other methods. We provide customer support 24/7 to provide assistance with critical post-upgrade issues.
The best method for successfully upgrading a production instance is to first test thoroughly on a sub-production instance. The testing process explained on this wiki page helps identify critical problems and related fixes on the sub-production instance. Use the information identified during testing to create a plan for addressing issues after upgrading the production instance.