从AppMaker数据库生成电子邮件列表 [英] Generating an email list from AppMaker Database

查看:63
本文介绍了从AppMaker数据库生成电子邮件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何获取涉及电子邮件列的数据库信息,创建包含所有电子邮件的数组,然后使用按钮"功能填充电子邮件页面的收件人:"部分. /p>

感谢您的帮助.在这方面非常新颖,并向我指出从何处获取信息将是很棒的.谢谢

解决方案

我建议您运行服务器脚本,该脚本将查询包含电子邮件的数据源.该脚本将如下所示:

function getEmails(){

  var query = app.models.<yourmodel>.newQuery();
  var results = query.run();

  var allEmails = [];

  if(results.length > 0){  
    for(var i = 0; i < results.length; i++){    
      var uniqueEmail = results[i].<emailfieldname>;
      allEmails.push(uniqueEmail);      
    }
  }

  return allEmails.join();      

}

然后将脚本添加到按钮小部件"onclick"事件中,该脚本将运行服务器脚本并处理返回的数据.与此类似:

function poulateToField(response){

  <widget path>.text/value = response;

}

google.script.run.withSuccessHandler(poulateToField).getEmails();

上面的 widget路径将是收件人:"小部件的路径,该小部件可以是文本框,文本区域等.在我的情况下,我使用了文本区域和路径是" widget.parent.descendants.TextArea1.value "

我希望这会有所帮助.如果您还有其他问题,请告诉我! :)

P.D.请不要忘记阅读 官方文档 更好更详细的解释.

I am trying to figure out how I can get database information involving the email column, make an array with all of the emails and then use the "button" feature to populate the "To:" part of an email page.

Any help is appreciated. Very new at this and pointing me on where to get the info would be great. Thanks

解决方案

I recommend you to run a server script that would query the datasource that has the emails. The script will look something like this:

function getEmails(){

  var query = app.models.<yourmodel>.newQuery();
  var results = query.run();

  var allEmails = [];

  if(results.length > 0){  
    for(var i = 0; i < results.length; i++){    
      var uniqueEmail = results[i].<emailfieldname>;
      allEmails.push(uniqueEmail);      
    }
  }

  return allEmails.join();      

}

Then add a script to the button widget "onclick" event that will run the server script and manipulate the returned data. Something similar to this:

function poulateToField(response){

  <widget path>.text/value = response;

}

google.script.run.withSuccessHandler(poulateToField).getEmails();

The above widget path would be the path to the "To:" widget, which can be a text box, text area, etc. In my case, I used a text area and the path was this "widget.parent.descendants.TextArea1.value"

I hope this helps. If you have more questions, just let me know! :)

P.D. Please don't forget to review the official documentation for a better and more detailed explanation.

这篇关于从AppMaker数据库生成电子邮件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆