I have put together a contact database and I am attempting to create a tool to email a specific list of users. These users are all part of many working groups. On the working group page I have a button that will pop up a table (view_85) that shows only the member emails. Using this table I want to pass the email addresses to a Gmail compose window:
$(document).on('knack-records-render.view_85', function(event, view, records) {
var elist = records;
window.open('https://mail.google.com/mail/?view=cm&fs=1&to=' +elist+ '&su=SUBJECT&body=BODY', '_blank');
});
This will grab the right number of records however it does not bring the data across. For each email address I see "[object Object]" in the email address field. I'm certain I am missing some key for the records object but I am not familiar enough with JS to know what it is. Is there anything I can add to records to get the values from the field?
Thanks, worked like a charm! I had to use records[0].field_15_raw.email as the starting variable but otherwise it is now doing what I need it to.
Josh you need to run a loop for each array element
for first email you can get
var email =records[0].field_15_raw[0].email
and pass this in url
Thanks,
Sunny singla
ssingla1985@gmail.com
+919855089359
Yes, it gives me an array:
- Array(5)
-
0:{id: "5922ea75ec8d99333941de74", field_15: "<a href="mailto:user1@user.com">user1@user.com</a>", field_15_raw: {…}, field_14: "User1", field_14_raw: {…}}
-
1:{id: "58a4b89e4953f4bd42d44c58", field_15: "<a href="mailto:user2@user.com">user2@user.com</a>", field_15_raw: {…}, field_14: "User2", field_14_raw: {…}}
-
2:{id: "58a4b8d34953f4bd42d455f6", field_15: "<a href="mailto:user3@user.com">user3@user.com</a>", field_15_raw: {…}, field_14: "User3", field_14_raw: {…}}
-
3:{id: "58a4b8b04953f4bd42d44ee5", field_15: "<a href="mailto:user4@user.com">user4@user.com</a>", field_15_raw: {…}, field_14: "User4", field_14_raw: {…}}
-
4:{id: "591b2d7d10e6e93b993e147e", field_15: "<a href="mailto:user5@user.com">user5@user.com</a>", field_15_raw: {…}, field_14: "User5", field_14_raw: {…}}
-
length:5
He Josh ,
Can you check what is in elist using console.log(elist) and see in console
Thanks,
Sunny singla
ssingla1985@gmail.com
+919855089359