I need a button to create a draft and update the current card, however I can only get 1 of those to work at a time.
// onGmailMessage.gs
CardService.newTextButton()
.setText('Create draft and update card')
.setComposeAction(CardService.newAction().setFunctionName('updateDraft'), CardService.ComposedEmailType.REPLY_AS_DRAFT)
This works:
// updateDraft()
return CardService.newComposeActionResponseBuilder()
.setGmailDraft(draft)
.build()
This doesn’t work:
// FIXME: The value returned from Apps Script has a type that cannot be used by the add-ons platform. Also make sure to call build on any builder before returning it.
return [
// Update the draft
CardService.newComposeActionResponseBuilder().setGmailDraft(draft).build(),
// Update the card
CardService.newActionResponseBuilder()
.setNavigation(
CardService.newNavigation().popToRoot().updateCard(onGmailMessage(e))
)
.setStateChanged(true)
.build(),
]