<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Event Field Mapping in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/event-field-mapping/m-p/3352883#M1222331</link>
    <description>&lt;P&gt;@Community Alums, you could try something like below.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VikMach_0-1755248221263.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/463152i99D28E445715A91B/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/463152i99D28E445715A91B/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/463152i99D28E445715A91B/image-dimensions/800x383?v=v2 2.0x, /community/image/serverpage/image-id/463152i99D28E445715A91B/image-dimensions/1200x575?v=v2 3.0x" role="button" title="VikMach_0-1755248221263.png" alt="VikMach_0-1755248221263.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if there is a scenario where you don't get any device name then you need to update the Regex as well. Just in case if you are getting a different email body.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VikMach_1-1755248337739.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-dimensions/800x389?v=v2 2.0x, /community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-dimensions/1200x584?v=v2 3.0x" role="button" title="VikMach_1-1755248337739.png" alt="VikMach_1-1755248337739.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// var incomingText = email.body_text; // Assuming you're capturing from an email body. For testing purposes I am hardcoding in text format to get the email body as plain text.
var body = `Organization: XYZ
Description: XYZ Jump-box for on-premise Domain controllers
Location: Main Office
Device: DEF
View device: Device_URL
Role: WINDOWS_SERVER
Time: 14 Aug 2025, 06:05:05
Severity: OK
Priority: LOW
Type: Condition
Status: Triggered
Message: Windows Service: 'Citrix Subscriptions Store (CitrixSubscriptionsStore)' is Stopped at '2025-08-14T05:03:12Z`;

// Regex pattern to extract the device name
var pattern = /Device:\s*(?!View)([A-Za-z0-9_-]+)/;
var match = body.match(pattern);

if (match) {
    var deviceName = match[1]; // Extracted device name

    // Now you can set this value to the CI field. I am logging for testing purposes.
    gs.info(deviceName);
} else {
    // Handle the case where no match is found
    gs.info("No device name found in the incoming text.");
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if this helped!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Vikas K&lt;/P&gt;</description>
    <pubDate>Fri, 15 Aug 2025 09:01:57 GMT</pubDate>
    <dc:creator>VikMach</dc:creator>
    <dc:date>2025-08-15T09:01:57Z</dc:date>
    <item>
      <title>Event Field Mapping</title>
      <link>https://www.servicenow.com/community/developer-forum/event-field-mapping/m-p/3352805#M1222324</link>
      <description>&lt;P&gt;I am getting an email in ServiceNow as below:&lt;/P&gt;&lt;LI-CODE lang="php"&gt;Organization: XYZ
Description: XYZ Jump-box for on-premise Domain controllers
Location: Main Office
Device: DEF
View device: Device_URL
Role: WINDOWS_SERVER
Time: 14 Aug 2025, 06:05:05
Severity: OK
Priority: LOW
Type: Condition
Status: Triggered
Message: Windows Service: 'Citrix Subscriptions Store (CitrixSubscriptionsStore)' is Stopped at '2025-08-14T05:03:12Z&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an inbound action that will create an event and associate an alert/ Incident to it. I want the CI field on the alert form to be populated with the Device name (DEF) from the email content. How to do this?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What I have done till now -&lt;/P&gt;&lt;P&gt;1. Created event field mapping&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Pushed the content in payload format in the additional_info field.&lt;/P&gt;&lt;P&gt;3. This works, but the data needs to be in JSON, and the incoming data is in string from mail.&lt;/P&gt;&lt;P&gt;--&amp;gt; Is there a way to use the event mapping for string data and use regex to find the dynamic value after the word 'Device'??&lt;/P&gt;&lt;P&gt;Or any alternate solution to get this done?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2025 06:30:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/event-field-mapping/m-p/3352805#M1222324</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2025-08-15T06:30:50Z</dc:date>
    </item>
    <item>
      <title>Re: Event Field Mapping</title>
      <link>https://www.servicenow.com/community/developer-forum/event-field-mapping/m-p/3352883#M1222331</link>
      <description>&lt;P&gt;@Community Alums, you could try something like below.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VikMach_0-1755248221263.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/463152i99D28E445715A91B/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/463152i99D28E445715A91B/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/463152i99D28E445715A91B/image-dimensions/800x383?v=v2 2.0x, /community/image/serverpage/image-id/463152i99D28E445715A91B/image-dimensions/1200x575?v=v2 3.0x" role="button" title="VikMach_0-1755248221263.png" alt="VikMach_0-1755248221263.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, if there is a scenario where you don't get any device name then you need to update the Regex as well. Just in case if you are getting a different email body.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VikMach_1-1755248337739.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-size/medium?v=v2&amp;amp;px=400" srcset="/community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-size/medium?v=v2&amp;amp;px=400 1.0x, /community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-dimensions/800x389?v=v2 2.0x, /community/image/serverpage/image-id/463153i8DBB9189C4FCB56A/image-dimensions/1200x584?v=v2 3.0x" role="button" title="VikMach_1-1755248337739.png" alt="VikMach_1-1755248337739.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// var incomingText = email.body_text; // Assuming you're capturing from an email body. For testing purposes I am hardcoding in text format to get the email body as plain text.
var body = `Organization: XYZ
Description: XYZ Jump-box for on-premise Domain controllers
Location: Main Office
Device: DEF
View device: Device_URL
Role: WINDOWS_SERVER
Time: 14 Aug 2025, 06:05:05
Severity: OK
Priority: LOW
Type: Condition
Status: Triggered
Message: Windows Service: 'Citrix Subscriptions Store (CitrixSubscriptionsStore)' is Stopped at '2025-08-14T05:03:12Z`;

// Regex pattern to extract the device name
var pattern = /Device:\s*(?!View)([A-Za-z0-9_-]+)/;
var match = body.match(pattern);

if (match) {
    var deviceName = match[1]; // Extracted device name

    // Now you can set this value to the CI field. I am logging for testing purposes.
    gs.info(deviceName);
} else {
    // Handle the case where no match is found
    gs.info("No device name found in the incoming text.");
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if this helped!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Vikas K&lt;/P&gt;</description>
      <pubDate>Fri, 15 Aug 2025 09:01:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/event-field-mapping/m-p/3352883#M1222331</guid>
      <dc:creator>VikMach</dc:creator>
      <dc:date>2025-08-15T09:01:57Z</dc:date>
    </item>
  </channel>
</rss>

