Alternate to current.setAbortAction

jbutz
Kilo Expert

Is there another way to stop a record insert when the business rule is running before insert without using current.setAbortAction(true)?

We have another product integrated with ServiceNow that does a SOAP insert, however under certain circumstances we don't want the record and we currently using current.setAbortAction to stop the insert. This works, but it sends a 500 error to the other product which then starts throwing errors.

I imagine I could have a business rule run after update and just delete the records we don't want, but I was hoping there was another alternate.

3 REPLIES 3

prdelong
Kilo Guru

If you're using Direct Web Services, I can't say I know of any alternative to SetAbortAction() other than the 'after' BR you mentioned.

If you're using Web Service Import Sets or Scripted Web Services, you can always tell the transform map to ignore (answer = ignore) any records that meet the conditions/circumstances which would normally call the SetAbortAction().


It's the direct web services, so I guess the 'after' BR is going to be my only choice.


Jacob_Andersen
ServiceNow Employee
ServiceNow Employee

Jbutz,

I think that the real issue is that, in general, you really should be using web service import sets to insert data in ServiceNow and not direct web services. I use the direct web services mainly for querying data. The reason for using web service import sets instead of direct web services is:

+You have a historical record of all inserts/updates that occurred through the endpoint.
+You can do data transformation w/o coding the logic in business rules. This keeps your normal process clean and does not introduce custom logic that is only relevant to your integration.
+The integrating program does not need to worry if something needs inserted or updated. It just sends that data and lets the transform map determine that for you.
+You can cancel an insert of data by setting the ignore flag to TRUE as well as send back a custom message.
+You can choose to run or not run the standard business rules on the table when doing your insert/update.
+And more.

They're very easy to use. Take a look at how to create and use web service import sets here:

http://wiki.servicenow.com/index.php?title=Web_Service_Import_Sets