Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How can I trigger an error in a transform map script in ServiceNow

PrathameshD3158
Tera Contributor

How can I trigger an error in a transform map script in ServiceNow so that the record goes to the 'onReject' stage instead of calling 'onForeignInsert' or 'onChoiceCreate'? I want to validate a field (like status = 'Pending') and prevent further processing if the value is invalid ?

1 REPLY 1

Rafael Batistot
Kilo Patron

Hi @PrathameshD3158 

To trigger a record rejection in a ServiceNow transform map, you must use an onBefore script and set the ignore variable to true. You can also provide a detailed error message by setting the error_message variable.

This stops the transformation for the current row, preventing subsequent scripts like onForeignInsert or onChoiceCreate from executing.

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.