Store appsmith value on page load?

Is there a way to store appsmith values on pageload, as opposed to having to use a widget to do this? I would like to have a number of appsmith.store variables be saved as ‘undefined’ on page load. Basically this:

{{
storeValue(“variable”, undefined);
}}

You can use a function to store the Appsmith values and configure it to run on page load. To run a JS function on page load, click on the gear icon and check the corresponding checkbox:

@Amelia - thanks! I am trying to do this but the gear icon is not showing up. Any ideas?

Looks like maybe still beta, but coming soon?

That’s right. It is already released on the cloud version and will be available very soon for self-hosted users too.

@trebuchet JS on page load today only works on asynchronous function. so just add async keyword on reset function and you should be able to see the gear.

reset: async () => {

}

OK, good to know @dancia and @Amelia . I’ve preconfiged it as async and will check this functionality again once it is avail for self-hosted. Thanks!

@Amelia - do you know if this has been made available for self-hosted yet? I am still unable to use it.

@trebuchet yes it is available in self-hosted as well

Hi @Nikhil - I am still not able, but I see I am on an older version. Should I be able to do it on self-hosted v1.6.16?

I am using docker. I see the instructions for updating docker versions of Appsmith. Looks like it removes and rebuilds the container. Will this wipe my instance and all of the apps I have?

@trebuchet no you will not lose any data. It’s stored in the mongo database.

Success! Upgraded and now can run the JS on page load. Thanks!