Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

how to restrict incident creation from calendar invites for DL

RudhraKAM
Tera Guru

As of now we are creating an Incidents via Inbound action , but when there is a calendar invite , still it is creating Incident , How to restrict that ?

 

I am not able to restrict subject , as it can be any 

 

RudhraKAM_0-1764942196011.png

 

45 REPLIES 45

pratyusha11
Tera Contributor
emailContent += '<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"><tr><td style="height:8px; line-height:8px; font-size:1px;">&nbsp;</td></tr></table>';

pratyusha11
Tera Contributor
var username = '';

if (elid) {
    var userGR = new GlideRecord('sys_user');
    userGR.addQuery('u_elid', 'IN', elid);   // <-- IN instead of default =
    userGR.query();

    var names = [];
    while (userGR.next()) {                  // <-- loop instead of single next()
        names.push(userGR.name.toString());
    }

    if (names.length > 0) {
        username = names.join(' and ');      // or ', ' depending on desired formatting
    }
}

pavani_paluri
Kilo Sage

Hi @RudhraKAM ,

 

Since the subject of a calendar invite can be anything, restricting Incident creation based on the email subject would not be a reliable solution.

A better approach would be to identify whether the incoming email is a calendar/meeting invite and skip the Incident creation logic in the Inbound Email Action.

You can check for indicators such as:

.ics attachments
BEGIN:VCALENDAR content in the email body
METHOD:REQUEST, METHOD:CANCEL, etc.
Calendar-related MIME types (text/calendar)

By adding a validation at the beginning of the Inbound Action script, you can prevent Incident creation whenever the incoming email is recognized as a calendar invite.

For example:

if (email.body_text.indexOf('BEGIN:VCALENDAR') > -1 ||
email.body_text.indexOf('METHOD:REQUEST') > -1) {
return; // Skip Incident creation
}


Alternatively, you can check for .ics attachments or calendar-related content types in the email headers.

This approach is more effective because it identifies the actual nature of the email rather than relying on the subject line, which can vary from one meeting invite to another.

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P

pratyusha11
Tera Contributor
gs.info('DEBUG TCM - elid raw: [' + elid + '] length: ' + elid.length);
gs.info('DEBUG TCM - encoded query: ' + userGR.getEncodedQuery());
gs.info('DEBUG TCM - can read user_name: ' + gs.hasRole('admin'));

pratyusha11
Tera Contributor
https://<your-instance>.service-now.com/sys_user_list.do?sysparm_query=active=true^u_elid=hickssl^ORuser_name=hickssl