AI and field validation

ericgilmore
Tera Guru

ver. Tokyo

 

This is just a random question which may or may not belong here. I was wondering if anyone has thought of using AI for field validation? For example, I'm working with a client that wants a list of every field {text fields, etc.} that could possibly accept PII, PHI data. One idea is that a set of business rules be built out which would be used to monitor various text fields and prevent the entry of SSN's and other PII/PHI.

 

My question is basically if there's any AI enabled way to do some type of field validation to search for PII/PHI?

1 ACCEPTED SOLUTION

Amit Gujarathi
Giga Sage
Giga Sage

Hi @ericgilmore ,
I trust you are doing great.

To achieve field validation for PII/PHI data, we can leverage ServiceNow's Business Rules and Regular Expressions. Here's a step-by-step approach:

  1. Define a list of text fields that need to be monitored for PII/PHI data entry.

  2. Create a Business Rule in ServiceNow to run on the table where these text fields exist. This rule should trigger on the 'before' or 'after' insert or update events, depending on your specific requirements.

  3. In the Business Rule script, implement a regular expression pattern matching to search for PII/PHI data. Regular expressions are powerful tools for pattern matching, and they can help identify specific patterns like Social Security Numbers (SSNs) or other PII/PHI formats.

    Here's an example of a regular expression that matches SSNs: /(^\d{3}-\d{2}-\d{4}$)|(^\d{9}$)/

  4. Within the Business Rule script, retrieve the field values from the record being inserted or updated. Apply the regular expression pattern matching on these values to identify any PII/PHI data.

  5. If a match is found, you can take appropriate actions, such as displaying an error message to the user, preventing the record from being saved, or triggering a workflow/notification to alert the necessary stakeholders.

Here's a sample code snippet in JavaScript, which can be used within the Business Rule:

 

(function executeRule(current, previous /*, g*/) {
  var fieldValues = [current.field1, current.field2, current.field3]; // Specify the text fields to monitor
  var regex = /(^\d{3}-\d{2}-\d{4}$)|(^\d{9}$)/; // Regular expression for SSN matching

  for (var i = 0; i < fieldValues.length; i++) {
    if (regex.test(fieldValues[i])) {
      current.setAbortAction(true); // Prevent record from being saved
      gs.addErrorMessage('PII/PHI data is not allowed in the field: ' + fieldValues[i]);
      break;
    }
  }
})(current, previous /*, g*/);

 


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Hi @ericgilmore ,

In ServiceNow as of now we do not have feasibilty to use AI for field validation unfortunately.

 

Amit Gujarathi
Giga Sage
Giga Sage

Hi @ericgilmore ,
I trust you are doing great.

To achieve field validation for PII/PHI data, we can leverage ServiceNow's Business Rules and Regular Expressions. Here's a step-by-step approach:

  1. Define a list of text fields that need to be monitored for PII/PHI data entry.

  2. Create a Business Rule in ServiceNow to run on the table where these text fields exist. This rule should trigger on the 'before' or 'after' insert or update events, depending on your specific requirements.

  3. In the Business Rule script, implement a regular expression pattern matching to search for PII/PHI data. Regular expressions are powerful tools for pattern matching, and they can help identify specific patterns like Social Security Numbers (SSNs) or other PII/PHI formats.

    Here's an example of a regular expression that matches SSNs: /(^\d{3}-\d{2}-\d{4}$)|(^\d{9}$)/

  4. Within the Business Rule script, retrieve the field values from the record being inserted or updated. Apply the regular expression pattern matching on these values to identify any PII/PHI data.

  5. If a match is found, you can take appropriate actions, such as displaying an error message to the user, preventing the record from being saved, or triggering a workflow/notification to alert the necessary stakeholders.

Here's a sample code snippet in JavaScript, which can be used within the Business Rule:

 

(function executeRule(current, previous /*, g*/) {
  var fieldValues = [current.field1, current.field2, current.field3]; // Specify the text fields to monitor
  var regex = /(^\d{3}-\d{2}-\d{4}$)|(^\d{9}$)/; // Regular expression for SSN matching

  for (var i = 0; i < fieldValues.length; i++) {
    if (regex.test(fieldValues[i])) {
      current.setAbortAction(true); // Prevent record from being saved
      gs.addErrorMessage('PII/PHI data is not allowed in the field: ' + fieldValues[i]);
      break;
    }
  }
})(current, previous /*, g*/);

 


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Community Alums
Not applicable

Hi @ericgilmore ,

I thought your question was related to AI and you were not looking for alternative solution !! Did you mistankenly marked the other answer correct?

 

Actually, you may be correct. Are you saying there IS a solution that would allow me to us AI for field validation?