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.

How to get "Email body" to the "comments"

F_bio Santos
Kilo Sage

Hi everyone Im trying to use an "Inbound Email Action" to get what the user writes on the "Email body" to the "comments" I have been trying to use the "email.body_text" but for some reason it just does not work, it is actually breaking the code ... can anyone help with this?

Code:

		if (email.subject.indexOf("reject") >= 0) {

			current.comments = 'Rejection Cause: ' + email.body_text;
			current.active = false;
			msgArray.push(displayValue);
			current.u_rejected = true;
			current.update();
		}
		if (email.subject.indexOf("approve") >= 0) {
			current.u_approved = true;
			msgArray.push(displayValue);
			current.update();
		}
5 REPLIES 5

Colin Doyle
Tera Contributor

Does your action have create/write access to the table it is targeting?

Yes, could the problem be that the "Additional comments" are "Readonly" ?

 

Anubhav24
Mega Sage

Hi @F_bio Santos ,

If you are referring to Additional Comments , they are stored in sys_journal_field , hence if you are updating comments for a RITM or Incident you might want to first update it in sys_journal_field.

Please mark helpful/correct if my response helped you.

Hi @Anubhav24 I dont want to update an already existing one, I want to create a new entry wityh the "body" of the email