Scott
Scott

Reputation: 485

Trouble converting Google App Maker from draft record in datasource

I see that the draft record in datasource is deprecated. I read the release notes but am having trouble with one bit of code. Tried to convert this:

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

to this:

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

But am getting this error: Cannot set property 'Email' of null

Any suggestions on what is wrong? The widget is being passed from the onValueChange action.

Thanks

Upvotes: 2

Views: 457

Answers (2)

Erica
Erica

Reputation: 46

You can change the widget's datasource to the create datasource in the Property Editor on the right side. Click the datasource binding and select "[Datasource Name] (create)". (screenshot)

An alternative option if you want to keep your widget bound to the normal datasource would be to set it programmatically:

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

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

Upvotes: 3

Devin Taylor
Devin Taylor

Reputation: 825

I believe you need to set your widget's data source to a "Create" data source, before converting to "item".

Upvotes: 2

Related Questions