How to differentiate between imported records and manually created records

veena_kvkk88
Mega Guru

Hello everyone,

I have a requirement to make only those records that are manually created (via a UI action that creates different metrics for different types of child task tables based on a field) on Metrics table (metric_instance). We have a periodic JDBC import that imports metrics from JIRA as well. So how do I differentiate between metrics that user created and the metrics that were imported?

From what I understand, the imported metrics will have 'created by' field set to 'system', and the other ones will have the name of user who created them. But I want to make sure that is right in all cases and this is the way to differentiate. Please help!!

Thanks in advance!

Chuck Tomasi
Tera Patron

Hi Veena,



The import could be run as an account or have a different name on it from "system". It depends how your import was set up. You could use that as a guideline, but I wouldn't trust it 100%.



What I would do is create a "u_source" field for the tables you want to track and populate it at import time. For example, it could say "jira" by way of your transform scirpt



target.u_source = 'jira';



Then you can sort, report, and filter on it all you like. If it's empty, you know it came from a user at the keyboard with an interactive session (either manually or via a script/workflow.)



Transform Map Scripts - ServiceNow Wiki


View solution in original post

Hi Chuck,



Thank you for the response. That solution makes sense. But is there no other way to identify the records that are imported? Other than manually setting a field?


Hi Veena,



Your original method of identifying the sys_created_by field would be the next best idea as long as the imports are consistent and run by an easily identifiable account.


Thank you so much Chuck, this helped