Json isn't saving to database text field

Hi mates!

I’m newbie using bubble. I’m making an app that saves data as a JSON and I want to save that json as a plain text in a field of my database, I have already Setup my RunScript and my JavascripttoBubble elements

The code is this

let dataParsed = JSON.stringify(documentData);
console.log(dataParsed)
bubble_fn_documentData(dataParsed);

// Convertir el objeto a formato JSON y enviarlo a make
let call = async function() {
    await fetch("URL", {
        method: "POST",
        headers: {
            "Content-Type": "application/json"
        },
        body: JSON.stringify(documentData)
    });
};

// Ejecutar la función
call()
    .then(() => console.log("Petición enviada exitosamente"))
    .catch(error => console.error("Error al enviar la petición:", error));



And when I try to update my thing with my JSON that field is always empty even when the debbugger and the console log shows the json as text.

Am I missing somenthing?

Hope you can help me :frowning: thanks in advance!

what does the debugger show as the value of the json to bubble element?

does your create new doc function work well?

Hi!

The debbuger show this:


image

Yeah I’ve tried with other fields like “accionSeguir1” as the photo shows and that fields fills correctly :confused:

Did you try to replace the json code with a random string like “x”? I want to be sure if it’s about the json or something else

yes if I try with a string it works hahaha thats weird :confused:

Can you share the json output please?

@gameclips.md changr your workflow series for saving the output. Instead of it being a step in the series that also includes the run JavaScript, have the action to save the data be from a trigger of Bubble JS event is triggered.

2 Likes

This. OP, other actions in the workflow will not wait for the final result of your Run Javascript action’s code. The J2B element will always have a value, in this case a null or blank value, in regards to how it interacts with other actions. A plugin’s result is a state after all.

Use the J2B event as advised.

1 Like

@boston85719
@ihsanzainal84

Yeah I’ve tried using J2B event and it finally works!

Thanks!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.