[Firebase] Are records auto removed from database?

[Firebase] Are records auto removed from database?

Forge Component
Published on 2017-08-24 by OutSystems Labs
10 votes
Published on 2017-08-24 by OutSystems Labs


We have an app where one user's action should trigger response action on other users. So we have a loop with the list of related users and send same event to each of them. However when looking on the database via console the events are appearing and immediately deleted from the db and only one record still persistent in the database. I've took a screenshot where the red highlighted records are being deleted immediately after creation. This leads to situation when only one of the users receives the event. 

What can be the reason for such behavior?

Thank you.

Hi Mykola,

Sorry for the late reply. Were you able to understand and solve this issue? Our firebase integration only allows one entry per identifier (FbTarget). However, as it is shown on your screeenshot, entries from different targets are being deleted, so I am confused myself. Do you still need help on this?

Best Regards

Hi Francisco,

Yes we still need help with identifying this issue.


Hi Francisco,

I've found this article regarding Firabase https://codepen.io/adamaoc/post/introduction-to-firebase and there is a description of set() method the is used on FirebaseNotifyEvent action:

Running the set() method on your Firebase reference will allow you to setup new data. You need to be careful with your use of set as it wipes out all of the existing data and resets it for the node you’re referencing.

So it should indeed only be 1 record on the database...

I've modified the event and the listener to fix this:

send JSNode in Firebase/notifyEvent:

var fbEventObject = JSON.parse($parameters.JsonParameters);


    fbEventObject[$parameters.TargetIdentifier].AdvancedJSON = JSON.parse($parameters.AdvancedJSON);



and the Callback JSNose in OnValueCallback action

var tempObj = $parameters.Snapshot.val();

console.log( $parameters.Snapshot.val());

    return "";
    $parameters.JSON = JSON.stringify(tempObj[$parameters.TargetIdentifier]); 

    if(typeof tempObj[$parameters.TargetIdentifier].AdvancedJSON === "undefined") {
        $parameters.AdvancedJSON = ""; 
    else {
        $parameters.AdvancedJSON = JSON.stringify(tempObj[$parameters.TargetIdentifier].AdvancedJSON);

so now REcords are structured like this:

If we remove the prepend JSON assign node we won't need tempObj[$parameters.TargetIdentifier] part and the structure on the database will be the same as currently but without deleting the records on new event :)

Thank you.