Custom field in Event (em_event) table to be populated in custom field in Alert (em_alert)

Nitin Agarwal
Kilo Contributor

I have to create a custom field in event table to map the field values from Soap based source integration as  listener transform script cannot be use in case of SOAP.

I have to mapped these custom field from event table to Alert table. I have created business rule to populate custom field in alert table.Business rule after insert on alert table and query for reference alert field in event table.Based on query result, value need to be copied from custom field of event to alert.

Below logic is not working.Also is there any alternative way to sync event to alert custom field.

-------------------------------------------

(function executeRule(current, previous /*null when async*/) {

// Add your code here

var em = new GlideRecord('em_event');
em.addQuery('alert', current.sys_id);
em.query();

if (em.next()){
if(JSUtil.notNil(em.u_audit_error_links)){
current.u_audit_error_links = em.u_audit_error_links;
current.update();
}
}
})(current, previous);

 

 

 

 

5 REPLIES 5

JF Muller
ServiceNow Employee
ServiceNow Employee

Hi Nitin,

 

em_event SHOULD NEVER BE modified... No business rules, no new columns to be added...

Please review:

https://docs.servicenow.com/bundle/madrid-it-operations-management/page/product/event-management/tas...

additional fields should be included in the Additional information [additional_info] field of the event.

For more information about how to include additional fields in events, see https://docs.servicenow.com/bundle/madrid-it-operations-management/page/product/event-management/con...

 

Regards

Jef


 

Hi Jef,

Thanks for your response. Since there is one to one mapping between Source and event field, additional_info cannot be  utilized.

Is there any other workaround to achieve this scenario.

Gianpaolo Pagan
ServiceNow Employee
ServiceNow Employee

Nitin,

 

What JF means is that you create the custom fields in the alert table and then you either have:

  • event rules to map the additional_info fields to the alert fields using the Transform and compose section to easily drag and drop the desired field in additional_info into your custom alert field.
  • In the additional_information section of the event you have a field that matches exactly the name of the custom alert field. In the following example I have a custom alert field called u_cid and I have a field in additional_information which matches that name. In this case no rule is required for mapping the name: find_real_file.pngfind_real_file.png

I hope this helps,

Gp

Hi GP,

Since this is SOAP based integration, ServiceNow field mapping is done at Source end. There is one to one field mapping at source end , Key with value cannot be shared in JSON format in Additional_info field of serviceNow. Otherwise it will be straight forward like other rest API based integrations.

Regards,

Nitin Agarwal