Returning Values form Local Storage

I have a value in localStorage called 'mcompcont'.

I am trying to return that value into a table called Invoices01 in the field 'compcont'.

I have tried 2 variations of the code in MySQL:

update Invoices01 set compcont = localStorage.setValue("mcompcont");

update Invoices01 set compcont = {{localStorage.mcompcont}} ;

Both of these return errors. I an attaching a screen shot of my local storage.
pict1

Any suggestions. I can find very little in the documentation.

Mike

Hey @mdsmith1! To retrieve a value from your localStorage, your JS expression should be localStorage.values.mcompcont. You will need to wrap in double curly braces within your MySQL query.

localStorage.setValue() is only for adding a new value, or overwriting an existing one with the same key.

The more helpful localStorage guidance is tucked away here: Share data between apps

Let me know how this goes!

Ryann:
Thank you so much, your code worked perfectly.
I will mark this as a Solution.
Thank you again.
Mike

1 Like

You’re welcome, glad I could help!