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,

what is the error?

Did you check any before insert BR on case table is restricting the insert

can you try to disable BR and check

current.subcategory = 0;

current.setWorkflow(false); // disables BR during insertion
current.insert();

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

I have checked all before business rules on insert on case table and tried deactivating one by one but still no luck.

I am not receiving any error in email logs. It is showing as "Create Case - CMS Security : did not create or update sn_customerservice_case using current"

Hi Sukku,

May be it is not entering yoru if condtion in your mail script. Can you try this code and check 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?
current.insert();
}

sukku
Tera Contributor

Hi asifnoor,

Script is entering in to if condition previously also. I have tried your script as well row count is coming as 1 and it is entering into if condition but still it is not creating a case. Value for category and subcategory is correct.

 

Hi,

your inbound email action is in which scope?

If it is in global scope then possibly insert from Global scope to a table present in HR Core scope is not allowed and hence insert is not working

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader