The following Google Apps Script code is the first to be run when the Gmail add-on is launched and is designed to prompt for a username of a student. The script is called via the 'onTriggerFunction' in the manifest file.
Save message to Drive add-on |
var inputWidget = CardService.newTextInput()Then add this to the section we created:
.setFieldName('userId')
.setTitle('Enter username here')
section.addWidget(inputWidget);Now we need a button action, a button to attach the action to and to add it to the card section. The action for the button is to run the getUserInfo function detailed in the next blog post. The button itself just contains the text Submit.
var buttonAction = CardService.newAction()The final part of this script finishes by adding the buttonSet widget to the section, the section to the card, then 'build' the card and return it.
.setFunctionName('getUserInfo');
var button = CardService.newTextButton()
.setText('Submit')
.setOnClickAction(buttonAction);
var buttonSet = CardService.newButtonSet()
.addButton(button)
No comments:
Post a Comment