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.

Event Field mapping script

Soni Rahul
Tera Contributor

Hi All,

I have a one requirement to add the assignment group of alerts based on some conditions through the event field mapping script, right now for testing purpose I am just hardcoding the assignment group in script but it's not working so can you please help me how I can update the assignment group of alerts through event field mapping script.


Script 

(function eventFieldMappingScript(eventGr, origEventSysId, ciSysId, fieldMappingRuleName) {
    try {
     eventGr.setValue('assignment_group', '287ee6fea9fe198100ada7950d0b1b73');
     return true;
  } catch (e) {
     gs.error(" The script type mapping rule '" + fieldMappingRuleName + "' ran with the error: \n" + e);
  }

 })(eventGr, origEventSysId, ciSysId, fieldMappingRuleName);

Thanks

5 REPLIES 5

Hi Vishal,

I think this will not work, as alert will only create after this execution is done, I have tested this as well and the alertNum returns me as null, please correct me if I am wrong.😉

Thanks.