Page 1 of 2

Listitem in sendgrid email

Posted: Sun Aug 16, 2015 11:20 am
by Johnny7459624

Hi there

I want to show the list that user created in email body. I done the tutorial of the todo app. Now I want to show it in email body.

For example: I created 5 todo things and I want to share it via mail with my wife. Now that 5 todo things are listed in email body.

"Only the list of the current user."

Image


Listitem in sendgrid email

Posted: Sun Aug 16, 2015 8:20 pm
by Serhii Kulibaba

Hello Johnny,

It is better to use storage variables for sending data via email, instead of UI components. So you have to create string variable with all array's items, then sent it via email


Listitem in sendgrid email

Posted: Mon Aug 17, 2015 8:37 am
by Johnny7459624

ok cool, i did add it like it is in User registration example.

See my image. How do i implement it in the body.

Thank you Image


Listitem in sendgrid email

Posted: Tue Aug 18, 2015 4:54 am
by Yurii Orishchuk

Hi Johnny,

Please use following JS code in JS section of this link:

pre

//Note: you need to replace "dogsStorage" with your storage name.
var someStorage = Apperyio.storage.dogsStorage.get();

var storageText = JSON.stringify(someStorage);

return "JSON value for the items = " + storageText;

/pre

Regards.


Listitem in sendgrid email

Posted: Tue Aug 18, 2015 5:58 am
by Johnny7459624

thank you very much for your help!


Listitem in sendgrid email

Posted: Tue Aug 18, 2015 7:01 am
by Johnny7459624

I tried it like in screenshot but email get error:

Tried:
Image

Error:
Image

if i remove that code email send.


Listitem in sendgrid email

Posted: Tue Aug 18, 2015 9:48 am
by Johnny7459624

Think found the problem but can you help me with it. I let it output in text box to see result.

Image


Listitem in sendgrid email

Posted: Wed Aug 19, 2015 11:01 am
by Johnny7459624

Hi any luck with this?


Listitem in sendgrid email

Posted: Fri Aug 21, 2015 5:06 am
by Johnny7459624

I tried this but not working.

Please help.

Code: Select all

 
 var output = '';  
var objectFromLS = JSON.parse(localStorage.getItem('stuffList')); for (var key in objectFromLS) { if (objectFromLS.hasOwnProperty(key)) { output = output+(key + ': ' +objectFromLS[key])+'\n'; } } Appery('txttoets').val(output);

Listitem in sendgrid email

Posted: Fri Aug 21, 2015 2:10 pm
by Serhii Kulibaba

Hello Johnny,

Could you check errors in the console? Please use:
preoutput = output+key + ':' +objectFromLS[key]+'\n';/pre
instead of:
preoutput = output+(key + ':
' +objectFromLS[key])+'\n';/pre