Rollback in ServiceNow script

Yuki21
Tera Expert

We are considering a method to roll back when an error occurs in the process of inserting the contents of the CSV file into the table one record at a time with the ServiceNow script.

Is it possible to implement rollback processing in a ServiceNow script?

I will post the scripts I have created so far, so I would appreciate it if you could also teach me how to implement it if possible.

<Example>
If an error occurs in rec.insert (); of the 5th record of the CSV file, I want to cancel the data of the 1st to 4th records.

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

That's why it's better to use import set so data can be verified before the actual import.

That said, following article has information on rolling back.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0826303

sys_rollback_context table has information.

View solution in original post

1 REPLY 1

Hitoshi Ozawa
Giga Sage
Giga Sage

That's why it's better to use import set so data can be verified before the actual import.

That said, following article has information on rolling back.

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0826303

sys_rollback_context table has information.