Trigger not running with rbf_deleteRecord

Posted by rzanardo on 13-Jul-2017 13:28

Hello everyone.

I'm really worried about a problem I've discovered yesterday and simply can't find a solution.

The basic structure:

I have an object called PROJECT, that is the base, and I have many "children/relationships" inside it, like the one I'm having problem, that it's called "Allocated Employee".

As the name suggests, you can allocate multiple employees to a project, but for a lot of reasons, I couldn't use Rollbase's native grids or forms for that, so I built a customized html table with bootstrap, jquery, etc.

This is what I'm talking about:

The "new" button and the "edit", uses Rollbase's own native LINKS at the objects to manipulate the data and open forms, etc. However, there is no URL for deleting, so I built a function for that purpose:

function deleteAllocatedEmployee(allocatedEmployeeID){
if (confirm("Are you sure?")){
rbf_deleteRecord("objectAllocatedEmployee", allocatedEmployeeID, function(){
location.reload();
}, false);
}

It's pretty simple, by clicking the delete of each record, it runs the above function and after the deleteRecord it reloads the page with the updated data. There's no problem with this, except that there's a trigger linked to the Allocated Employee object, that makes lots of references to another triggers, this system's logic is VERY complex.

But when I use the rbf_deleteRecord to delete an object, like in this case, the trigger that's associated to it simply doesn't run and I have no clue why.

Can someone please try to help me? Am I doing something (if not all) wrong?

Thanks in advance!

Posted by rzanardo on 14-Jul-2017 07:20

Hi Srinivas.

Thank you for answering.

I think I have figured out the "kind" of the problem. It's not about the trigger being fired or not, because in fact, it is.

I added one of the native Rollbase lists to try the "delete" method, and it didn't work either. This tells me that the real problem is something with my trigger.

The scenario is something like this : The project's employees counter is set to 3. I delete one, drops to 2. If I delete another, drops to 1. But if I delete the last one, it doesnt drop to 0. The last one isn't running the trigger correctly. I'm wondering that maybe it is some logic failure at the trigger.

I'll check it out more. Anyway thank you for helping me!

All Replies

Posted by Srinivas Panyala on 14-Jul-2017 01:44

Hi Zanardo,
 
What is the trigger type? And what is the trigger timing option you have used “Before Delete” or “After Delete”?
 
If possible please provide a sample application to reproduce the issue.
 
Thanks,
Srinivas
 

Posted by jniemi@vyco.com on 14-Jul-2017 07:19

Hello,

Have you tried adding the delete process to a server side trigger and then use the rbf_runTriggers() call from the client to perform the delete?  I don't know if it will work for you or not, but you might be able to use that as a work around to ensure the triggers fire before/after delete.

Posted by rzanardo on 14-Jul-2017 07:20

Hi Srinivas.

Thank you for answering.

I think I have figured out the "kind" of the problem. It's not about the trigger being fired or not, because in fact, it is.

I added one of the native Rollbase lists to try the "delete" method, and it didn't work either. This tells me that the real problem is something with my trigger.

The scenario is something like this : The project's employees counter is set to 3. I delete one, drops to 2. If I delete another, drops to 1. But if I delete the last one, it doesnt drop to 0. The last one isn't running the trigger correctly. I'm wondering that maybe it is some logic failure at the trigger.

I'll check it out more. Anyway thank you for helping me!

This thread is closed