- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 05:13 AM
Hi all,
I have the following issue. I have a custom table and a business rule set on it that avoids creating a record when a particular condition is met.
The business rule is set to rune BEFORE and in the script I have the usual command:
I've added some logs to check if the business rules and the setAbortAction were running and they are.
The behavior I get is the following:
1. If in a script a create the record, I get the error message but a new ID is still created, even if the record is not added to the table:
2. If I create a record using a Script API it returns 201 (cause the record ID is created) but the record is not actually in the table. How do I get the result of the business rule in the script? Or is there a way not to generate the record ID so I can check in the Create API if the record was actually created?
Would you know how to sort out this issue?
Thanks,
Alex
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 10:15 AM
@Alessandro Penn Whenever a new record is about to be created a function getNextObjNumberPadded is called and a number is assigned to the new record before its creation. Since the record is aborted before when the order id was empty, it wasn't stored with in the table. However, the Number counter incremented and hence the next records get a number greater than the previous number.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2024 08:51 AM
@Alessandro Penn Could you please explain your question with some examples/scripts. How are you are calling the API and the script used for creating the record.