无法从数据源中的草稿记录转换 Google App Maker

Trouble converting Google App Maker from draft record in datasource

我看到数据源中的草稿记录已被弃用。我阅读了 release notes 但在使用一段代码时遇到了问题。试图转换这个:

widget.datasource.draft.Email = (newValue) ? newValue.PrimaryEmail : null;

对此:

widget.datasource.item.Email = (newValue) ? newValue.PrimaryEmail : null;

但出现此错误:无法设置 属性 'Email' 为 null

有什么错误的建议吗?正在从 onValueChange 操作传递小部件。

谢谢

我认为您需要将小部件的数据源设置为 "Create" 数据源,然后再转换为 "item"。

您可以在右侧的 属性 编辑器中将小部件的数据源更改为创建数据源。单击数据源绑定和 select“[数据源名称](创建)”。 (screenshot)

如果您想将小部件绑定到普通数据源,另一种选择是通过编程方式进行设置:

widget.datasource.modes.create.item.Email = (newValue) ? newValue.PrimaryEmail : null;

Here is further documentation for accessing the create datasource through scripting.