Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Creating a case via inbound email action

sukku
Tera Contributor

Hi All,

We have a requirement to create a case via inbound email action when from address matches user profile in user table.

Use case is like when we send a mail from our outlook to xyz shared mail box, then that shared mailbox will forward that emails to our servicenow instance. When I check in the logs of emails in servicenow Recipients is setting like xyz shared mailbox and user id column is setting it as original sender wh...

Now we want to create a case when that original sender user profile is present in user table. 

Could someone help on this usecase please.

 

Thanks and Regards,

Sukanya.

1 ACCEPTED SOLUTION

I don't think there is any such restriction as far as i know. May be there is any BR which might be checking for jpgs and restricting it. Kindly check once.

Mark the comments as helpful if they had helped to debug the issue.

View solution in original post

19 REPLIES 19

Hi,

We have created separate application scope and inbound is created in this scope not in global scope.

Okay, so can you go to system logs once and check if you are getting any error.

Also try to print the sys_id of the newly created record liek this and share the logs.

var Userem = new GlideRecord('sys_user');
Userem.addQuery('email', email.from.toString());
Userem.query();
gs.info("Test: No. of rows are "+Userem.getRowCount());
if (Userem.next()) {
  gs.info("Test: Entered into if condtion");
current.u_requestor = Userem.name;
current.short_description = email.subject.toString();
current.description = email.body_text.toString();
current.contact_type = "email";
current.category = 0; //IS THIS RIGHT VALUE?
current.subcategory = 0; //IS THIS RIGHT VALUE?
var sysid = current.insert();
gs.info("Test: sys id of newly created record is "+sysid);
}

Mark the comment as a correct answer and helfpul if it helps to solve the problem.

sukku
Tera Contributor

Hi asifnnor,

Please find the below screenshot of email logs and also application logs.

I am not getting the last log which is written after insert.

 

find_real_file.pngfind_real_file.png

Hi,

In the error log i don't see this line output. Can you check. 

gs.info("Test: sys id of newly created record is "+sysid);

If its added but not coming, then there should be some error after the log "Entered into if condtion".

 

sukku
Tera Contributor

Hi asifnoor,

Yes this log has been added. But this is not coming in logs. When I have removed the script and just tried setting short description, description through actions like below screenshot it created a case. But actually i need to check in user table if sender exists in user table. if it exists then it should create a case with proper subject as short description, description as email body and some other parameters.

find_real_file.pngfind_real_file.png