How to convert Email body to JSON in serviceNow. I need this for event creation from Email?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 12:33 PM
How to convert Email body to JSON in ServiceNow. I need this for event creation from Email?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 12:36 PM
Hi,
You don't necessarily "need" to convert the email body to JSON to send it as a parm in an event. The event just needs string in the parm. It won't pass along a parsed JSON anyway...
So you can use:
var string = email.body_text;
gs.eventQueue('event_name', current, string, '');
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 12:40 PM
Can you explain more about it. We are using flow designer to get the inbound email and then converting it to event through create record ACTION.
Now in the filters we are mapping the value of Description to body_text.
For Event Rules, when we are trying to map the values to other fields from description it is not working.
This script which you have provided where can I utilize it in my scenario?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 12:47 PM
Hi,
You never said flow designer in your original post, so my reply was geared towards traditional inbound actions. With that said, please always try and give as much information as you can in your original post so people don't waste their time and reply with confusing things that aren't relevant to you.
You also didn't share that you've already pushed the body_text to another record's description field already. So several things you did not share.
You can share an example of what you have for the description field so I can see...otherwise, you'd need to parse the description field to JSON so you can use it as obj.property:
JSON.parse(record.field_name);
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2025 05:51 AM
Hi Allen,
i want to use the email body keywords as identifier, so how to get it in from email body?
