在应用中处理我从Google表格中获取用户的电子邮件地址。
我想使用该电子邮件地址来显示目录中的全名和缩略图照片。
Screenshot of the UI - 电子邮件&隐藏名称以保护用户数据
到目前为止,当我尝试链接这两个时,我从目录中获取所有用户的第一张照片。
任何想法如何将两者联系起来,因为目录不支持添加新的关系?
答案 0 :(得分:1)
。
//Get the Spreadsheet Data
var spreadsheetData = app.models.MySpreadsheetSource.newQuery().run();
var combinedData = []; // Place to store output for calculated model
spreadsheetData.forEach(function(record){ //iterate the ss data
var query = app.models.Directory.newQuery(); //start a query for directory
query.filters.PrimaryEmail._equals = record.email; //set the query for the email
var dirRecord = query.run()[0]; //get the one record
//make a new record for the calculated model
var newRecord = app.models.Directory_Spreadsheet.newRecord();
//add the data from both SS and Directory models
newRecord.Email = record.email; //from ss
newRecord.address = record.address;
newRecord.Full_Name = dirRecord.FullName; //from Directory
newRecord.Thumbnail = dirRecord.ThumbnailPhotoUrl;
//Add More Fields
combinedData.push(newRecord); //add to output
});
return combinedData; //return the combine object
您可以在Accordion中使用此数据源来显示组合数据。
答案 1 :(得分:0)