Deleting a record using rules

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Deleting a record using rules

Post by customaware »

Not sure how to make this work.

I have a situation whereby the user creates a record and rules do some checking of the new record. In particular cases the new record MAY be deemed invalid and should be discarded.

So, I guess the question is......

Is it possible to delete a record after the user has click Create but using the Rules of the BO?
I know I can use REPORT ERROR but this record may have been specifically altered by the earlier rules and I do not want the User to be questioned regarding an error. I just want the record discarded.

Not sure if I have explained this very well but hopefully someone will get the gist.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
hpl123
Posts: 2599
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Possible solution

Post by hpl123 »

A possible solution is having an yes/no flag attribute in this BO that the BO rules flag based on if the instance is invalid or not and then you use a scheduled process to delete flagged BO every hour or so. If there is an problem with e.g. the user seeing this invalid instance, the flag could also work as a filter to hide these instances from users.

There might be other and possible better solutions for this, the solution above is what came to mind when i read you post.
Henrik (V8 Developer Ed. - Windows)
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

I used this method Henrik and it tok a bit of fiddling around but got it to work.

Thanx.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
ACDC
Posts: 1142
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Post by ACDC »

The most obvious way is to use DELETE Object instead of REPORT ERROR,
unless I am missing something
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Post by customaware »

Hi ACDC,

DELETE Object does not work in this instance as an error is generated due to the fact that the remaining rules have not yet been executed and the system thinks the Object has been deleted by another user.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
ACDC
Posts: 1142
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Post by ACDC »

Try this, When you create the object use IF NEW .... to run the validate rule(s) and then on the DELETE rule use IF NOT Object IS NEW .

Then in the process that creates the Object, at the end of the process insert UPDATE Object . So the UPDATE event will take care of the DELETE rule after the object has been created
Post Reply