Populate RITM variable values through inbound action

Renu9
Tera Contributor

Hi All,

I am triggering a service request through inbound email action.

Where in I need to populate values in RITM variables with the content in email body.

I am using below script, but it is not working. Kindly suggest me any modifcations.

var ritmRec = new GlideRecord("sc_req_item");
ritmRec.addQuery("request", rc.sys_id);
ritmRec.query();
if (ritmRec.next()) {
ritmRec.short_description = email.subject.toString();
ritmRec.description = email.body_text.toString();
ritmRec.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.employee_no = email.body.employee_number.toString();
current.employee_name=email.body.employee_name.toString();
ritmRec.update();

employee_no and employee_name are not populating. Sending email as below.

Employee Number:12345

Employee Name:Test

And also noticed REQ's are not generating in order.

REQ0017421,REQ0017423,REQ0017425

One number is getting skipped. Kindly suggest what is missing here

9 REPLIES 9

Happy to know that you are able to get the variable's details. In my view your code is correct.

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar

Hello Renu,

Happy to know that you are able to get the variable's details. In my view your code is correct. 

From my past worked scenario on these types of req's , It is not necessary that you will be getting the continuous REQ or RITM Number, because those REQ & RITMs are generated by the system. 


Mark it as helpful or correct, If Applicable

Cheers..!
Happy Learning:)
Tushar

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar

Renu9
Tera Contributor

Hi Tushar,

 

Could you please help me know how to keep data in Date field in variables through inbound action.

Ex: 01/04/2022

current.variables.start_date=email.body.start_date; is not giving proper date in the field

Hello Renu, Can you please share what date you are getting & what you are entering in the email?

 

Also can you please check in your instance what is the format for date? After checking once try to write the date in the email as your profile time format.

You can find like Go to Profile -> check what is the format for date.

Trt to go through below link as well which explains how to parse date in the required format.

https://community.servicenow.com/community?id=community_question&sys_id=bf9f0365dbdcdbc01dcaf3231f96190f

 

Cheers..!

Tushar

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar

Hello Renu,
Dis it help you to get the correct dates?

Cheers..!
Tushar

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar