Business rule abort action

Alessandro Penn
Tera Contributor

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:

current.setAbortAction(true
 
Following some screenshots of the set up:
 
AlessandroPenn_0-1721995446147.png

 

 

AlessandroPenn_2-1721995639661.png

 


 

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:

AlessandroPenn_3-1721995862150.png

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

1 ACCEPTED SOLUTION

@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.

View solution in original post

5 REPLIES 5

@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.